Are there standard functions to perform absolute <--> relative path conversion in Delphi?
For example:
'C:\Projects\Project1\'
'..\Shared\somefile.pas'
'C:\Projects\Shared\somefile.pas'
I am looking for something like this:
function AbsToRel(const AbsPath, BasePath: string): string;
// '..\Shared\somefile.pas' =
// AbsToRel('C:\Projects\Shared\somefile.pas', 'C:\Projects\Project1\')
function RelToAbs(const RelPath, BasePath: string): string;
// 'C:\Projects\Shared\somefile.pas' =
// RelToAbs('..\Shared\somefile.pas', 'C:\Projects\Project1\')
To convert to the absolute you have :
ExpandFileName
To have the relative path you have :
ExtractRelativePath