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

Michael Van Canneyt michael at freepascal.org
Mon Feb 11 12:35:32 CET 2013

On Mon, 11 Feb 2013, Giuliano Colla wrote:

> Il 11/02/2013 09:21, Michael Van Canneyt ha scritto:
>> On Mon, 11 Feb 2013, Giuliano Colla wrote:
>>> 3) But if also the *path* to the file doesn't yet exist, it just crashes 
>>> without rising an exception that the user application can handle somehow.
>> This is incorrect. It does tell you why it fails.
>>> This is rather unpleasant, because the path provided by GetAppConfigXx 
>>> does usually exist, so you have an application which 99% of the times 
>>> works just fine, and 1% of the times crashes without telling why.
>> It tells you *exactly* why it 'crashes':
>> home: >./ti
>> An unhandled exception occurred at $000000000042AE87:
>> EFCreateError: Unable to create file "/tmp/path/to/nothing.txt"
>>   $000000000042AE87
> This is true only if you invoke the program from command line, which is 
> something the end user will never do.

That is not the problem of TIniFile, but of the application programmer.

TIniFile properly reports any error, as it should, with an exception.
It is always up to the application programmer to deal with such cases.

That this is sometimes tricky in a GUI application, cannot be helped.


More information about the fpc-pascal mailing list