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

Bart bartjunk64 at gmail.com
Mon Aug 20 23:43:52 CEST 2012


On 8/20/12, Tomas Hajny <XHajT03 at hajny.biz> wrote:

> If that is the original problem, you could use the following check:
>
> if ExpandFileName (APath+'..'+DirectorySeparator) <> ExpandFileName
> (APath) then ...
[snip]
> implementation). DirectoryExists for 'c:\..\' returns true under Win32 for
> the same reason.

The supplied path in this scenario (Delphi converter) already is
processed for any .. in it by TrimFileName() (FileProcs unit from
Lazarus CodeTools).

And yes, it will not detect a substituted drive or a network drive,
but in the context of the original problem, this is not really a
problem.

[quote]
Your program is in directory C:\Bug4, right?
Could you try moving it one level down in directory hierarchy, for
example to C:\SW\Bug4 or whatever.

The converter scans in a background thread all directories under the
converted project's parent directory, searching for pascal source
files. Many projects have library sources organized that way.
Obviously it creates a problem if your project is just under C:\ root.
[/quote]

For this the current solution will do for now.
Both Juha and me were just wondering if any such function already existed.

Given your comments, I can see it's unlikely we will have such a
general function, given all the possible exceptions mentioned above.

Thanks everybody for your input.

Bart



More information about the fpc-pascal mailing list