瀏覽代碼

Bug 71: Case-sensitive synchronization

https://winscp.net/tracker/71
(cherry picked from commit b686736604176a5560955b250691513ca7353169)

Source commit: 0c9278521e52c4af1d18c5de33f426c0fb1fdda0
Martin Prikryl 5 年之前
父節點
當前提交
dbb67622c5

+ 1 - 1
source/core/Script.cpp

@@ -428,7 +428,7 @@ void __fastcall TScript::SetSynchronizeParams(int value)
 {
   const int AcceptedParams =
     TTerminal::spExistingOnly | TTerminal::spTimestamp |
-    TTerminal::spNotByTime | TTerminal::spBySize;
+    TTerminal::spNotByTime | TTerminal::spBySize | TTerminal::spCaseSensitive;
   FSynchronizeParams = (value & AcceptedParams);
   FWarnNonDefaultSynchronizeParams =
     (FSynchronizeParams != (TTerminal::spDefault & AcceptedParams));

+ 2 - 1
source/core/Terminal.cpp

@@ -5600,6 +5600,7 @@ UnicodeString __fastcall TTerminal::SynchronizeParamsStr(int Params)
   AddFlagName(ParamsStr, Params, spTimestamp, L"Timestamp");
   AddFlagName(ParamsStr, Params, spNotByTime, L"NotByTime");
   AddFlagName(ParamsStr, Params, spBySize, L"BySize");
+  AddFlagName(ParamsStr, Params, spCaseSensitive, L"CaseSensitive");
   AddFlagName(ParamsStr, Params, spSelectedOnly, L"*SelectedOnly"); // GUI only
   AddFlagName(ParamsStr, Params, spMirror, L"Mirror");
   if (Params > 0)
@@ -5705,7 +5706,7 @@ void __fastcall TTerminal::DoSynchronizeCollectDirectory(const UnicodeString Loc
 
   try
   {
-    Data.LocalFileList = CreateSortedStringList();
+    Data.LocalFileList = CreateSortedStringList(FLAGSET(Params, spCaseSensitive));
 
     TSearchRecOwned SearchRec;
     if (LocalFindFirstLoop(Data.LocalDirectory + L"*.*", SearchRec))

+ 1 - 0
source/core/Terminal.h

@@ -142,6 +142,7 @@ public:
   static const int spBySize = 0x400; // cannot be combined with smBoth, has opposite meaning for spTimestamp
   static const int spSelectedOnly = 0x800; // not used by core
   static const int spMirror = 0x1000;
+  static const int spCaseSensitive = 0x2000;
   static const int spDefault = TTerminal::spNoConfirmation | TTerminal::spPreviewChanges;
 
 // for TranslateLockedPath()

+ 2 - 1
source/forms/CustomScpExplorer.cpp

@@ -5358,7 +5358,8 @@ bool __fastcall TCustomScpExplorerForm::DoSynchronizeDirectories(
   Params.RemoteDirectory = RemoteDirectory;
   int UnusedParams =
     (GUIConfiguration->SynchronizeParams &
-      (TTerminal::spPreviewChanges | TTerminal::spTimestamp | TTerminal::spNotByTime | TTerminal::spBySize));
+      (TTerminal::spPreviewChanges | TTerminal::spTimestamp | TTerminal::spNotByTime | TTerminal::spBySize |
+       TTerminal::spCaseSensitive));
   Params.Params = GUIConfiguration->SynchronizeParams & ~UnusedParams;
   Params.Options = GUIConfiguration->SynchronizeOptions;
   bool SaveSettings = false;

+ 5 - 2
source/forms/FullSynchronize.cpp

@@ -265,7 +265,8 @@ void __fastcall TFullSynchronizeDialog::SetParams(int value)
 {
   FParams = value &
     ~(TTerminal::spDelete | TTerminal::spExistingOnly | TTerminal::spPreviewChanges | TTerminal::spTimestamp |
-      TTerminal::spNotByTime | TTerminal::spBySize | TTerminal::spSelectedOnly | TTerminal::spMirror);
+      TTerminal::spNotByTime | TTerminal::spBySize | TTerminal::spSelectedOnly | TTerminal::spMirror |
+      TTerminal::spCaseSensitive);
   SynchronizeDeleteCheck->Checked = FLAGSET(value, TTerminal::spDelete);
   SynchronizeExistingOnlyCheck->Checked = FLAGSET(value, TTerminal::spExistingOnly);
   SynchronizePreviewChangesCheck->Checked = FLAGSET(value, TTerminal::spPreviewChanges);
@@ -284,6 +285,7 @@ void __fastcall TFullSynchronizeDialog::SetParams(int value)
   }
   SynchronizeByTimeCheck->Checked = FLAGCLEAR(value, TTerminal::spNotByTime);
   SynchronizeBySizeCheck->Checked = FLAGSET(value, TTerminal::spBySize);
+  SynchronizeCaseSensitiveCheck->Checked = FLAGSET(value, TTerminal::spCaseSensitive);
   UpdateControls();
 }
 //---------------------------------------------------------------------------
@@ -298,7 +300,8 @@ int __fastcall TFullSynchronizeDialog::GetParams()
       TTerminal::spTimestamp) |
     FLAGMASK(MirrorFilesButton->Checked, TTerminal::spMirror) |
     FLAGMASK(!SynchronizeByTimeCheck->Checked, TTerminal::spNotByTime) |
-    FLAGMASK(SynchronizeBySizeCheck->Checked, TTerminal::spBySize);
+    FLAGMASK(SynchronizeBySizeCheck->Checked, TTerminal::spBySize) |
+    FLAGMASK(SynchronizeCaseSensitiveCheck->Checked, TTerminal::spCaseSensitive);
 }
 //---------------------------------------------------------------------------
 void __fastcall TFullSynchronizeDialog::LocalDirectoryBrowseButtonClick(

+ 23 - 13
source/forms/FullSynchronize.dfm

@@ -6,7 +6,7 @@ object FullSynchronizeDialog: TFullSynchronizeDialog
   BorderIcons = [biSystemMenu, biMinimize, biMaximize, biHelp]
   BorderStyle = bsDialog
   Caption = 'Synchronize'
-  ClientHeight = 429
+  ClientHeight = 453
   ClientWidth = 481
   Color = clBtnFace
   ParentFont = True
@@ -16,7 +16,7 @@ object FullSynchronizeDialog: TFullSynchronizeDialog
   OnShow = FormShow
   DesignSize = (
     481
-    429)
+    453)
   PixelsPerInch = 96
   TextHeight = 13
   object DirectoriesGroup: TGroupBox
@@ -90,7 +90,7 @@ object FullSynchronizeDialog: TFullSynchronizeDialog
   end
   object OkButton: TButton
     Left = 220
-    Top = 396
+    Top = 420
     Width = 88
     Height = 25
     Anchors = [akRight, akBottom]
@@ -103,7 +103,7 @@ object FullSynchronizeDialog: TFullSynchronizeDialog
   end
   object CancelButton: TButton
     Left = 315
-    Top = 396
+    Top = 420
     Width = 75
     Height = 25
     Anchors = [akRight, akBottom]
@@ -116,12 +116,12 @@ object FullSynchronizeDialog: TFullSynchronizeDialog
     Left = 8
     Top = 238
     Width = 303
-    Height = 73
+    Height = 97
     Caption = 'Synchronize options'
     TabOrder = 3
     DesignSize = (
       303
-      73)
+      97)
     object SynchronizeDeleteCheck: TCheckBox
       Left = 11
       Top = 20
@@ -163,7 +163,7 @@ object FullSynchronizeDialog: TFullSynchronizeDialog
   end
   object TransferSettingsButton: TButton
     Left = 8
-    Top = 396
+    Top = 420
     Width = 161
     Height = 25
     Anchors = [akLeft, akBottom]
@@ -213,13 +213,13 @@ object FullSynchronizeDialog: TFullSynchronizeDialog
     Left = 317
     Top = 238
     Width = 156
-    Height = 73
+    Height = 97
     Anchors = [akLeft, akTop, akRight]
     Caption = 'Comparison criteria'
     TabOrder = 4
     DesignSize = (
       156
-      73)
+      97)
     object SynchronizeByTimeCheck: TCheckBox
       Left = 11
       Top = 20
@@ -240,10 +240,20 @@ object FullSynchronizeDialog: TFullSynchronizeDialog
       TabOrder = 1
       OnClick = ControlChange
     end
+    object SynchronizeCaseSensitiveCheck: TCheckBox
+      Left = 11
+      Top = 68
+      Width = 138
+      Height = 17
+      Anchors = [akLeft, akTop, akRight]
+      Caption = 'C&ase sensitive'
+      TabOrder = 2
+      OnClick = ControlChange
+    end
   end
   object SaveSettingsCheck: TCheckBox
     Left = 19
-    Top = 317
+    Top = 341
     Width = 454
     Height = 17
     Anchors = [akLeft, akTop, akRight]
@@ -252,7 +262,7 @@ object FullSynchronizeDialog: TFullSynchronizeDialog
   end
   object CopyParamGroup: TGroupBox
     Left = 8
-    Top = 338
+    Top = 362
     Width = 465
     Height = 50
     Anchors = [akLeft, akTop, akRight]
@@ -278,7 +288,7 @@ object FullSynchronizeDialog: TFullSynchronizeDialog
   end
   object HelpButton: TButton
     Left = 397
-    Top = 396
+    Top = 420
     Width = 75
     Height = 25
     Anchors = [akRight, akBottom]
@@ -324,7 +334,7 @@ object FullSynchronizeDialog: TFullSynchronizeDialog
   end
   object OkMenu: TPopupMenu
     Left = 416
-    Top = 336
+    Top = 360
     object Start1: TMenuItem
       Caption = '&Start'
       Default = True

+ 1 - 0
source/forms/FullSynchronize.h

@@ -51,6 +51,7 @@ __published:
   TPopupMenu *OkMenu;
   TMenuItem *Start1;
   TMenuItem *StartInNewWindowItem;
+  TCheckBox *SynchronizeCaseSensitiveCheck;
   void __fastcall ControlChange(TObject *Sender);
   void __fastcall LocalDirectoryBrowseButtonClick(TObject *Sender);
   void __fastcall TransferSettingsButtonClick(TObject *Sender);