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

Mark Morgan Lloyd markMLl.fpc-pascal at telemetry.co.uk
Tue Feb 12 10:02:03 CET 2013


Sven Barth wrote:
> On 11.02.2013 15:30, Mark Morgan Lloyd wrote:
>> If anything, it is the fault
>> of AppConfigDir for indicating a directory without raising an exception
>> pointing out that it doesn't yet exist :-)
>>
> 
> And AppConfigDir/File is documented as not guaranteeing that the path to 
> the directory or file exists. This also includes upper parts of the 
> path's tree.

I admit that I was slightly trolling there, since Giuliano was 
complaining about exceptions that he wasn't seeing (because, it turns 
out, he wasn't catching them).

However I feel that my point stands: if the program opens, checks and 
closes the .ini file before the main logic starts, then it's possible to 
keep those initial activities separate from any try-finally required by 
the application logic. This initial activity obviously still requires 
both a try-finally and a try-except, which is where he was going wrong 
with his initial attempt.

-- 
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]



More information about the fpc-pascal mailing list