瀏覽代碼

Moving local variables close to use with shorter life span

Source commit: 5ef01ef94c1cef2c5a26352dc9a80ccdc4a01974
Martin Prikryl 9 年之前
父節點
當前提交
05acc541f8
共有 1 個文件被更改,包括 10 次插入9 次删除
  1. 10 9
      source/forms/CustomScpExplorer.cpp

+ 10 - 9
source/forms/CustomScpExplorer.cpp

@@ -1674,19 +1674,20 @@ void __fastcall TCustomScpExplorerForm::CustomCommand(TStrings * FileList,
 {
 
   TCustomCommandData Data(Terminal);
-  std::unique_ptr<TCustomCommand> CustomCommandForOptions;
-  if (FLAGCLEAR(ACommand.Params, ccLocal))
-  {
-    CustomCommandForOptions.reset(new TRemoteCustomCommand(Data, Terminal->CurrentDirectory));
-  }
-  else
-  {
-    CustomCommandForOptions.reset(new TLocalCustomCommand(Data, Terminal->CurrentDirectory, DefaultDownloadTargetDirectory()));
-  }
 
   std::unique_ptr<TStrings> CustomCommandOptions(CloneStrings(WinConfiguration->CustomCommandOptions));
   if (ACommand.AnyOptionWithFlag(TCustomCommandType::ofRun))
   {
+    std::unique_ptr<TCustomCommand> CustomCommandForOptions;
+    if (FLAGCLEAR(ACommand.Params, ccLocal))
+    {
+      CustomCommandForOptions.reset(new TRemoteCustomCommand(Data, Terminal->CurrentDirectory));
+    }
+    else
+    {
+      CustomCommandForOptions.reset(new TLocalCustomCommand(Data, Terminal->CurrentDirectory, DefaultDownloadTargetDirectory()));
+    }
+
     if (!DoCustomCommandOptionsDialog(&ACommand, CustomCommandOptions.get(), TCustomCommandType::ofRun, CustomCommandForOptions.get()))
     {
       Abort();