[fpc-pascal] Too tired? Forcedirectories does not seem to work
Sven Barth
pascaldragon at googlemail.com
Mon Feb 6 20:53:26 CET 2012
On 06.02.2012 18:14, Reinier Olislagers wrote:
> On 6-2-2012 17:50, Henry Vermaak wrote:
>> On 06/02/12 16:40, Reinier Olislagers wrote:
>>> This code:
>>> OperationSucceeded:=ForceDirectories(BootstrapCompilerDirectory);
>>> debugln('todo: debug: forcedirectories bootstrap compiler dir:
>>> '+bootstrapcompilerdirectory+' result: '+BoolToStr(Operationsucceeded));
>>>
>>> should create a directory (~/fpcbootstrap by default):
> <snip>
>>> What am I doing wrong?
>>
>> Your shell expands ~ to your home directory. Your program will have to
>> do this manually (i.e. read the "HOME" environment variable).
>>
> I understand. Apparently ExpandFileName does this for me.
>
> Still, I don't understand why I got a result that was true when FPC
> apparent!??!.... Oh now I do, it created the directory "~\fpcbootstrap".
> That was fun ;)
>
> Perhaps I should submit a patch for the docs indicating that:
> - ForceDirectories requires an absolute path
This is wrong. ForceDirectories works with relative paths as well. It
just does not work with path variables that are only known to the shell.
> - On Unix/Linux, directories starting with ~ are considered relative
> (but where should that be put...)
This is basic Linux/Unix knowledge: every path that does not start with
a "/" is a relative path.
Regards,
Sven
More information about the fpc-pascal
mailing list