[fpc-pascal] Re: Fpc Access Violation if AppConfigDir doesn't exist.

Michael Van Canneyt michael at freepascal.org
Sat Feb 9 16:19:26 CET 2013



On Sat, 9 Feb 2013, Bart wrote:

> On 2/9/13, Michael Van Canneyt <michael at freepascal.org> wrote:
>
>>> If creating the directory fails, the function does not return an
>>> errorcode, unless we decide to let it raise an exception in this
>>> case..
>>
>
>> There is only one way:
>> if the ForceCreate is implemented and if creation fails, an exception
>> will be raised.
>
> And in this case the OP still needs to do an extra check
> (try..except), so basically this does not solve his "problem" because
> it is unsolvable without the programmer checking/validating what
> GetAppConfigDir did.

Which is why I always write the code to check/create the dir myself.

But having the check/create in a central place can have its advantages.

Michael.



More information about the fpc-pascal mailing list