[fpc-pascal] Too tired? Forcedirectories does not seem to work

Jürgen Hestermann juergen.hestermann at gmx.de
Tue Feb 7 17:37:43 CET 2012


Reinier Olislagers schrieb:
 > And while ~ is a relative path,

No, this is an absolute path (pointing to the home directory). It only 
needs expansion to give you this absolute path. It's just a placeholder 
for a certain absolute path (which can vary). One or two dots would be a 
relative path (meaning current  and parent directory).


 > the defining characteristic is that is a
 > character that gets expanded by (at least) the shell, as Mattias pointed
 > out in his other mail.

And it's not the only variable that can be expanded (by the shell). 
Environment variables may be used in paths too.


 > Still, ExpandFileName DOES expand ~ to /home/whatever, and that is not
 > mentioned in help:
 > "ExpandFileName expands the filename to an absolute filename."

How can this be misunderstood? What else should be expanded if not 
placeholders and variables?



 > I think the docs for ExpandFileName should be updated to indicate ~ gets
 > expanded, e.g.:
 > "ExpandFileName expands the filename to an absolute filename. On
 > Unix/Linux systems, ExpandFileName will also expand the ~ (home
 > directory) symbol."

But ~ is not the only placeholder that will be expanded. Relative paths 
would become absolute paths and environment variables will be replaced 
by their values too. And I think it's not restricted to Linus/Unix, it 
happens on Windows too. So if at all I would list all these possible 
expansions:

"ExpandFileName expands the filename to an absolute filename. Replaced 
would be
-) placeholders (like ~)
-) environment variables (like HOME)
-) relative path would completed to absolute paths
etc.



More information about the fpc-pascal mailing list