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

Reinier Olislagers reinierolislagers at gmail.com
Mon Feb 6 18:14:03 CET 2012


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
- On Unix/Linux, directories starting with ~ are considered relative
(but where should that be put...)

Suggestions welcome.

In any case, glad this works, thanks for the help!

Reinier



More information about the fpc-pascal mailing list