Bläddra i källkod

Bug 1938: Allow downloading versioned VMS file in scripting

https://winscp.net/tracker/1938
(cherry picked from commit e9168fcda0abbbd0c32a8dedd5dc934f576f0af1)

Source commit: d02e47baef5e3cfbe89186d3641d94fd217f6cd1
Martin Prikryl 4 år sedan
förälder
incheckning
bf0e65e581
2 ändrade filer med 10 tillägg och 1 borttagningar
  1. 9 1
      source/core/FtpFileSystem.cpp
  2. 1 0
      source/core/FtpFileSystem.h

+ 9 - 1
source/core/FtpFileSystem.cpp

@@ -374,6 +374,7 @@ void __fastcall TFTPFileSystem::Open()
   FMVS = false;
   FMVS = false;
   FVMS = false;
   FVMS = false;
   FTransferActiveImmediately = (Data->FtpTransferActiveImmediately == asOn);
   FTransferActiveImmediately = (Data->FtpTransferActiveImmediately == asOn);
+  FVmsAllRevisions = false;
 
 
   FSessionInfo.LoginTime = Now();
   FSessionInfo.LoginTime = Now();
   FSessionInfo.CertificateVerifiedManually = false;
   FSessionInfo.CertificateVerifiedManually = false;
@@ -2330,6 +2331,13 @@ void __fastcall TFTPFileSystem::ReadFile(const UnicodeString FileName,
       {
       {
         NameOnly = FileName.SubString(P + 1, FileName.Length() - P - 1);
         NameOnly = FileName.SubString(P + 1, FileName.Length() - P - 1);
       }
       }
+      DebugAssert(!FVmsAllRevisions);
+      TAutoFlag VmsAllRevisionsFlag(FVmsAllRevisions);
+      if (FVMS && (NameOnly.Pos(L";") > 2))
+      {
+        FTerminal->LogEvent(L"VMS versioned file detected, asking for all revisions");
+        FVmsAllRevisions = true;
+      }
       TRemoteFile * AFile = NULL;
       TRemoteFile * AFile = NULL;
       // FZAPI does not have efficient way to read properties of one file.
       // FZAPI does not have efficient way to read properties of one file.
       // In case we need properties of set of files from the same directory,
       // In case we need properties of set of files from the same directory,
@@ -2695,7 +2703,7 @@ int __fastcall TFTPFileSystem::GetOptionVal(int OptionID) const
       break;
       break;
 
 
     case OPTION_VMSALLREVISIONS:
     case OPTION_VMSALLREVISIONS:
-      Result = FALSE;
+      Result = FVmsAllRevisions ? TRUE : FALSE;
       break;
       break;
 
 
     case OPTION_SPEEDLIMIT_DOWNLOAD_TYPE:
     case OPTION_SPEEDLIMIT_DOWNLOAD_TYPE:

+ 1 - 0
source/core/FtpFileSystem.h

@@ -295,6 +295,7 @@ private:
   bool FVMS;
   bool FVMS;
   bool FFileTransferAny;
   bool FFileTransferAny;
   bool FLoggedIn;
   bool FLoggedIn;
+  bool FVmsAllRevisions;
   mutable UnicodeString FOptionScratch;
   mutable UnicodeString FOptionScratch;
 };
 };
 //---------------------------------------------------------------------------
 //---------------------------------------------------------------------------