[fpc-pascal] Possible RTFM question: is there something like an IsRootPath() function?
Jürgen Hestermann
juergen.hestermann at gmx.de
Mon Aug 20 15:47:12 CEST 2012
Am 2012-08-20 14:38, schrieb Sven Barth:
> Am 20.08.2012 14:05, schrieb Jürgen Hestermann:
>> The question is: For what reason is this function needed? If you use
>> "subst" on Windows you can make every path to a root path if you want.
>
> Maybe because he wants to determine whether a path is absolute or not?
Absolute? You mean in contrast to relative? Then you only need to look for . or .. in parts of the path.
If you mean that it is the root of a disk then you cannot be sure by looking at the path because as mentioned with subst you can make any path to be a root path. If Z:\ points to c:\data\whatever then of what use is it to know that Z:\ is a root path?
> So that he can e.g. convert an absolute path to a relative one so he can save this in a configuration in a more "portable" way.
For this purpose functions already exist (ExpandPath). But there is no need to know about root or not if you use them.
> "subst" (or adding the path to DosDevices in the registry which is the way I prefer for persistent substing ;) ) might be a completely wrong solution or a > solution where you shoot cannonballs on little birds...
I did not write that subst should be a solution to anything. It was just an example that any path can be made a root path with subst.
More information about the fpc-pascal
mailing list