Pascal Scripting: ExtractRelativePath

Inno Setup

Pascal Scripting: ExtractRelativePath

Prototype:

function ExtractRelativePath(const BaseName, DestName: String): String;

Description:

Converts a fully qualified path name into a relative path name. The DestName parameter specifies the file name (including path) to be converted. BaseName is the fully qualified name of the base directory to which the returned path name should be relative. BaseName may or may not include a file name, but it must include the final path delimiter.

ExtractRelativePath strips out common path directories and inserts '..\' for each level up from the BaseName.

Example:
var
  S: String;
begin
  S := ExtractRelativePath('c:\windows\system32\', 'c:\autoexec.bat');
  // S = ..\..\autoexec.bat
end;