Procházet zdrojové kódy

Remove GetShortNameRedir because it's not used anywhere. Move GetShortName to ScriptFunc.HelperFunc because only ScriptFunc uses it.

Martijn Laan před 1 měsícem
rodič
revize
cd8c10ebd5

+ 0 - 16
Projects/Src/Setup.RedirFunc.pas

@@ -51,7 +51,6 @@ function FileOrDirExistsRedir(const DisableFsRedir: Boolean; const Filename: Str
 function FindFirstFileRedir(const DisableFsRedir: Boolean; const Filename: String;
   var FindData: TWin32FindData): THandle;
 function GetFileAttributesRedir(const DisableFsRedir: Boolean; const Filename: String): DWORD;
-function GetShortNameRedir(const DisableFsRedir: Boolean; const Filename: String): String;
 function GetVersionNumbersRedir(const DisableFsRedir: Boolean; const Filename: String;
   var VersionNumbers: TFileVersionNumbers): Boolean;
 function IsDirectoryAndNotReparsePointRedir(const DisableFsRedir: Boolean;
@@ -348,21 +347,6 @@ begin
   SetLastError(ErrorCode);
 end;
 
-function GetShortNameRedir(const DisableFsRedir: Boolean; const Filename: String): String;
-var
-  PrevState: TPreviousFsRedirectionState;
-begin
-  if not DisableFsRedirectionIf(DisableFsRedir, PrevState) then begin
-    Result := Filename;
-    Exit;
-  end;
-  try
-    Result := GetShortName(Filename);
-  finally
-    RestoreFsRedirection(PrevState);
-  end;
-end;
-
 function GetVersionNumbersRedir(const DisableFsRedir: Boolean; const Filename: String;
   var VersionNumbers: TFileVersionNumbers): Boolean;
 var

+ 18 - 0
Projects/Src/Setup.ScriptFunc.HelperFunc.pas

@@ -96,6 +96,7 @@ function LoadStringsFromFile(const FileName: String; const Stack: TPSStack;
 function SaveStringToFile(const FileName: String; const S: AnsiString; Append: Boolean): Boolean;
 function SaveStringsToFile(const FileName: String; const Stack: TPSStack;
   const ItemNo: Longint; Append, UTF8, UTF8WithoutBOM: Boolean): Boolean;
+function GetShortName(const LongName: String): String;
 function CreateCallback(const Caller: TPSExec; const P: PPSVariantProcPtr): NativeInt;
 
 implementation
@@ -639,6 +640,23 @@ begin
   end;
 end;
 
+function GetShortName(const LongName: String): String;
+{ Gets the short version of the specified long filename. If the file does not
+  exist, or some other error occurs, it returns LongName. }
+var
+  Res: DWORD;
+begin
+  SetLength(Result, MAX_PATH);
+  repeat
+    Res := GetShortPathName(PChar(LongName), PChar(Result), ULength(Result));
+    if Res = 0 then begin
+      Result := LongName;
+      Break;
+    end;
+  until AdjustLength(Result, Res);
+end;
+
+
 var
   ASMInliners: array of Pointer;
 

+ 0 - 17
Projects/Src/Shared.CommonFunc.pas

@@ -122,7 +122,6 @@ function NewParamCount: Integer;
 function NewParamStr(Index: Integer): string;
 function AddQuotes(const S: String): String;
 function RemoveQuotes(const S: String): String;
-function GetShortName(const LongName: String): String;
 function GetWinDir: String;
 function GetSystemWinDir: String;
 function GetSystemDir: String;
@@ -659,22 +658,6 @@ begin
   end;
 end;
 
-function GetShortName(const LongName: String): String;
-{ Gets the short version of the specified long filename. If the file does not
-  exist, or some other error occurs, it returns LongName. }
-var
-  Res: DWORD;
-begin
-  SetLength(Result, MAX_PATH);
-  repeat
-    Res := GetShortPathName(PChar(LongName), PChar(Result), ULength(Result));
-    if Res = 0 then begin
-      Result := LongName;
-      Break;
-    end;
-  until AdjustLength(Result, Res);
-end;
-
 function GetWinDir: String;
 { Returns fully qualified path of the Windows directory. Only includes a
   trailing backslash if the Windows directory is the root directory. }