Просмотр исходного кода

Really fix CopyFile/FileCopy discrepancy between [Code] and ISPP.

Martijn Laan 1 год назад
Родитель
Сommit
72db34c719

+ 2 - 2
ISHelp/isxfunc.xml

@@ -1843,8 +1843,8 @@ end;</pre>
         <remarks><p>Can't be used to rename Setup itself.</p></remarks>
       </function>
       <function>
-        <name>FileCopy</name>
-        <prototype>function FileCopy(const ExistingFile, NewFile: String; const FailIfExists: Boolean): Boolean;</prototype>
+        <name>CopyFile</name>
+        <prototype>function CopyFile(const ExistingFile, NewFile: String; const FailIfExists: Boolean): Boolean;</prototype>
         <description><p>Copies ExistingFile to NewFile, preserving time stamp and file attributes.<br />If FailIfExists is True it will fail if NewFile already exists, otherwise it will overwrite it.<br />Returns True if successful, False otherwise.</p></description>
         <remarks><p>Can't be used to copy Setup itself.</p></remarks>
       </function>

+ 1 - 0
Projects/Src/Compiler.ScriptFunc.pas

@@ -148,6 +148,7 @@ begin
   ObsoleteFunctionWarnings.Add('IsComponentSelected', Format(SCompilerCodeFunctionRenamed, ['IsComponentSelected', 'WizardIsComponentSelected']));
   ObsoleteFunctionWarnings.Add('IsTaskSelected', Format(SCompilerCodeFunctionRenamed, ['IsTaskSelected', 'WizardIsTaskSelected']));
   ObsoleteFunctionWarnings.Add('IsX64', Format(SCompilerCodeFunctionDeprecatedWithAlternativeAndDocs, ['IsX64', 'IsX64OS', 'IsX64Compatible', 'Architecture Identifiers']));
+  ObsoleteFunctionWarnings.Add('FileCopy', Format(SCompilerCodeFunctionRenamed, ['FileCopy', 'CopyFile']));
 
   RegisterConst('MaxInt', MaxInt);
 

+ 1 - 1
Projects/Src/Setup.ScriptFunc.pas

@@ -555,7 +555,7 @@ begin
     Stack.SetString(PStart-1, S);
   end else if Proc.Name = 'USINGWINNT' then begin
     Stack.SetBool(PStart, True);
-  end else if Proc.Name = 'FILECOPY' then begin
+  end else if (Proc.Name = 'COPYFILE') or (Proc.Name = 'FILECOPY') then begin
     ExistingFilename := Stack.GetString(PStart-1);
     if not IsSrcExe(ExistingFilename) then
       Stack.SetBool(PStart, CopyFileRedir(ScriptFuncDisableFsRedir,

+ 2 - 1
Projects/Src/Shared.ScriptFunc.pas

@@ -277,7 +277,8 @@ initialization
     'function StringChange(var S: String; const FromStr, ToStr: String): Integer;',
     'function StringChangeEx(var S: String; const FromStr, ToStr: String; const SupportDBCS: Boolean): Integer;',
     'function UsingWinNT: Boolean;',
-    'function FileCopy(const ExistingFile, NewFile: String; const FailIfExists: Boolean): Boolean;',
+    'function CopyFile(const ExistingFile, NewFile: String; const FailIfExists: Boolean): Boolean;',
+    'function FileCopy(const ExistingFile, NewFile: String; const FailIfExists: Boolean): Boolean;', { old name of CopyFile }
     'function ConvertPercentStr(var S: String): Boolean;',
     'function RegValueExists(const RootKey: Integer; const SubKeyName, ValueName: String): Boolean;',
     'function RegQueryStringValue(const RootKey: Integer; const SubKeyName, ValueName: String; var ResultStr: String): Boolean;',

+ 1 - 0
whatsnew.htm

@@ -87,6 +87,7 @@ For conditions of distribution and use, see <a href="files/is/license.txt">LICEN
     <li>Added new <tt>ExecAndCaptureOutput</tt> support function to execute a program or batch file and capture its <i>stdout</i> and <i>stderr</i> outputs separately.</li>
     <li>Output logging now raises an exception if there was an error setting up output redirection (which should be very rare). The <i>PowerShell.iss</i> example script has been updated to catch the exception.</li>  
     <li>Documented support functions <tt>VarArrayGet</tt> and <tt>VarArraySet</tt> which were already available but not documented.</li>
+    <li>Renamed the <tt>FileCopy</tt> support function to <tt>CopyFile</tt>. The old name is still supported, but it is recommended to update your scripts to the new name and the compiler will issue a warning if you don't.</li>
   </ul>
   </li>
   <li>ISPP change: Added support functions <tt>GetSHA256OfFile</tt>, <tt>GetSHA256OfString</tt>, and <tt>GetSHA256OfUnicodeString</tt>.</li>