[fpc-pascal] Possible RTFM question: is there something like an IsRootPath() function?

Mattias Gaertner nc-gaertnma at netcologne.de
Mon Aug 20 16:28:28 CEST 2012


On Mon, 20 Aug 2012 14:38:05 +0200
Sven Barth <pascaldragon at googlemail.com> wrote:

> Am 20.08.2012 14:05, schrieb Jürgen Hestermann:
> > Am 2012-08-20 00:17, schrieb Bart:
> >  > Does fpc have a function that determines if a given paths is the root
> >  > (e.g. '/' in Linux, 'F:\' in Windows)?
> >
> > 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? 

No, for this there is FilenameIsAbsolute in LazUtils.

It is about scanning the directory. Juha needs a simple
heuristic if the converter should search the parent directory for
related files.
Apparently it is a bad idea to scan a root directory.

See
http://bugs.freepascal.org/view.php?id=22630


> 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. "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...


Mattias



More information about the fpc-pascal mailing list