[Overview][Constants][Types][Classes][Procedures and functions][Index] |
CreateRelativePath - given an absolute file path and aBaseDirectory, create a file path relative to the given base directory
Source position: fileutil.pas line 92
function CreateRelativePath( |
const Filename: String; |
const BaseDirectory: String; |
UsePointDirectory: Boolean = false |
):String; |
Filename |
|
The absolute FileName for which a relative path is to be created |
BaseDirectory |
|
BaseDirectory of the absolute search path |
The file name expressed as path relative to the current directory
CreateRelativePath - given an absolute path and a BaseDirectory, create a file path relative to the given base directory
The returned string includes the correct number of dots and double dots to signify relativity to the current directory (eg ../../or ..\..\ etc). The inverse operation is to create an absolute file path:
RelPath:=CreateRelativePath(AbsPath,BaseDir); if FilenameIsAbsolute(RelPath) then NewAbsPath:=RelPath else NewAbsPath:=AppendPathDelim(BaseDir)+RelPath;
If BaseDirectory is empty, functions exits and returns with Result equal to Filename; if Filename is empty, function exits with empty Result
lazarus-ccr.sourceforge.net |