[fpc-pascal] fpc in symlinked directory
Mattias Gaertner
nc-gaertnma at netcologne.de
Tue Mar 25 21:46:57 CET 2014
On Tue, 25 Mar 2014 21:07:45 +0100 (CET)
Michael Van Canneyt <michael at freepascal.org> wrote:
>[...]
> > For example a way to tell fpc to use the PWD environment
> > variable?
>
> No.
>
> Because if you do a Chdir('ABC') inside a FPC program,
'a FPC program' sounds as if you are talking about console programs
in general. My question is only about the compiler.
> the CWD variable is no longer valid.
> So it would require us to keep track of what you do.
What can I do to the compiler, that needs tracking?
> We could hook the Chdir and SetDirectory calls. But that would go
> wrong at the first direct syscall or library call that changes the
> current directory.
>
> So, FPC uses a system call to get the correct (resolved) CWD directory.
> This is the only guaranteed mechanism.
What's wrong with this:
if GetEnvironmentVariable('PWD')<>'' then
SetCurrentDir(GetEnvironmentVariable('PWD'));
?
> So, the best Lazarus can do is resolve all directories before calling the compiler.
If you mean with "resolve" to convert relative paths to absolute paths:
That is not sufficient.
For example when the program uses a unit in the same directory, the
compiler uses its current directory.
> Since you brought it up:
> IMHO Lazarus must do this resolving anyhow, because now Lazarus does not work at all with symlinks, e.g. to find filenames and resolve packages. Regardless of what the compiler does.
>
> I submitted bugreports on the list about this in the past.
I remember some problems. Formerly the IDE resolved symlinks, which
was wrong. This was fixed.
Mattias
More information about the fpc-pascal
mailing list