Browse Source

Bug fix: Custom command patterns were replaced in values of extension options

Source commit: 9a09b2f0b3c0bb17cd81045381220c2863c7af64
Martin Prikryl 9 years ago
parent
commit
52632dc707
3 changed files with 9 additions and 1 deletions
  1. 6 1
      source/core/FileMasks.cpp
  2. 2 0
      source/core/FileMasks.h
  3. 1 0
      source/windows/WinConfiguration.cpp

+ 6 - 1
source/core/FileMasks.cpp

@@ -789,6 +789,11 @@ void __fastcall TFileMasks::SetStr(const UnicodeString Str, bool SingleMask)
 const wchar_t TCustomCommand::NoQuote = L'\0';
 const UnicodeString TCustomCommand::Quotes = L"\"'";
 //---------------------------------------------------------------------------
+UnicodeString __fastcall TCustomCommand::Escape(const UnicodeString & S)
+{
+  return ReplaceStr(S, L"!", L"!!");
+}
+//---------------------------------------------------------------------------
 TCustomCommand::TCustomCommand()
 {
 }
@@ -915,7 +920,7 @@ UnicodeString __fastcall TCustomCommand::Complete(const UnicodeString & Command,
       {
         if (!LastPass)
         {
-          Replacement = ReplaceStr(Replacement, L"!", L"!!");
+          Replacement = Escape(Replacement);
         }
         if (Delimit)
         {

+ 2 - 0
source/core/FileMasks.h

@@ -139,6 +139,8 @@ public:
   UnicodeString __fastcall Complete(const UnicodeString & Command, bool LastPass);
   virtual void __fastcall Validate(const UnicodeString & Command);
 
+  static UnicodeString __fastcall Escape(const UnicodeString & S);
+
 protected:
   static const wchar_t NoQuote;
   static const UnicodeString Quotes;

+ 1 - 0
source/windows/WinConfiguration.cpp

@@ -3142,6 +3142,7 @@ UnicodeString __fastcall TCustomCommandType::GetCommandWithExpandedOptions(TStri
         OptionValue = Option.Default;
       }
       UnicodeString OptionCommand = GetOptionCommand(Option, OptionValue);
+      OptionCommand = TCustomCommand::Escape(OptionCommand);
       Result = ReplaceText(Result, FORMAT(L"%%%s%%", (Option.Id)), OptionCommand);
     }
   }