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

Bart bartjunk64 at gmail.com
Sat Feb 9 16:07:54 CET 2013


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.

function GetAppConfigDir(Global: Boolean; ForceCreate: Boolean;
WhatToDoIfCreationFails: TProcedure) would "solve" the original
problem ;-)

Bart

Bart



More information about the fpc-pascal mailing list