浏览代码

Fix previous: though SeparateDirective always returned trimmed values but it doesnt.

Martijn Laan 1 年之前
父节点
当前提交
5b6e82a44c
共有 1 个文件被更改,包括 4 次插入2 次删除
  1. 4 2
      Projects/Src/Compile.pas

+ 4 - 2
Projects/Src/Compile.pas

@@ -3224,6 +3224,7 @@ begin
   end;
 end;
 
+{ Note: result Value may include leading/trailing whitespaces if it was quoted! }
 procedure TSetupCompiler.SeparateDirective(const Line: PChar;
   var Key, Value: String);
 var
@@ -3245,7 +3246,7 @@ begin
     { If Value is surrounded in quotes, remove them. Note that unlike parameter
       values, for backward compatibility we don't require embedded quotes to be
       doubled, nor do we require surrounding quotes when there's a quote in
-      the middle of the value. }
+      the middle of the value. Does *not* remove whitespace after removing quotes! }
     if (Length(Value) >= 2) and
        (Value[1] = '"') and (Value[Length(Value)] = '"') then
       Value := Copy(Value, 2, Length(Value)-2);
@@ -3620,7 +3621,7 @@ begin
         end;
       end;
     ssCompression: begin
-        Value := LowerCase(Value);
+        Value := LowerCase(Trim(Value));
         if Value = 'none' then begin
           CompressMethod := cmStored;
           CompressLevel := 0;
@@ -3797,6 +3798,7 @@ begin
         InfoAfterFile := Value;
       end;
     ssInternalCompressLevel: begin
+        Value := Trim(Value);
         if (Value = '0') or (CompareText(Value, 'none') = 0) then
           InternalCompressLevel := 0
         else if not LZMAGetLevel(Value, InternalCompressLevel) then