Conversion between absolute and relative paths in Delphi – Stack Overflow
Posted by jpluimers on 2013/07/30
A while ago, I needed routines to work with absolute and relative paths on Windows.
These links were very useful:
- The Delphi TPath.IsDriveRooted function (I think it was introduced in Delphi 2010) serves as a IsPathAbsolute function
- Conversion between absolute and relative paths in Delphi – Stack Overflow showing how to use the Windows API functions PathRelativePathTo and PathCanonicalize functions declared in the ShLwApi unit to create AbsToRel and RelToAbs functions.
Thanks Andreas Rejbrand and David Heffernan for the last two!
–jeroen
via: Conversion between absolute and relative paths in Delphi – Stack Overflow.
Suren Sarathkumara said
Use System.IOUtils.GetFullPAth
jpluimers said
I’m not sure (as right now I do not have access to the sources right now), but I think System.IOUtils.GetFullPAth only works one way, or would only work without specifying a base directory and I needed both ways while specifying a base directory.
Joseph said
You shouldn’t need to be using Windows API functions; Delphi is supposed to be a cross-platform solution now.
jpluimers said
Back then I needed a solution working in Windows. If you have one that works cross platform: please contribute it.