Are there standard functions to perform absolute <--> relative path conversion in Delphi?
For example:
- 'Base' path is
'C:ProjectsProject1'
- Relative path is
'..Sharedsomefile.pas'
- Absolute path is
'C:ProjectsSharedsomefile.pas'
I am looking for something like this:
function AbsToRel(const AbsPath, BasePath: string): string;
// '..Sharedsomefile.pas' =
// AbsToRel('C:ProjectsSharedsomefile.pas', 'C:ProjectsProject1')
function RelToAbs(const RelPath, BasePath: string): string;
// 'C:ProjectsSharedsomefile.pas' =
// RelToAbs('..Sharedsomefile.pas', 'C:ProjectsProject1')
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…