[fpc-pascal] Re: Fpc Access Violation if AppConfigDir doesn't exist.
Reinier Olislagers
reinierolislagers at gmail.com
Sat Feb 9 08:38:08 CET 2013
On 9-2-2013 1:49, Giuliano Colla wrote:
> It turned out that the reason was simply that the default AppConfigDir
> (~/.config/ ) wasn't there, and therefore in the two usual lines
>
> AppConfigFileName:= GetAppConfigFile(False);
> ini := TIniFile.Create(AppConfigFileName);
>
> the second line was generating the access violation.
>
> Desktop specs tell where configuration data should go, but they don't
> guarantee that the directory exists. Other applications take care of
> creating if it doesn't exist, but its presence depends on which
> applications you launch.
>
> Of course, once one knows, one can use ForceDirectories in the
> application code, but it would be much more user friendly if
> XdgConfigHome (or SysConfigDir when it will be implemented) in sysutils
> took care of that. You ask for the default configuration path to put
> your data in, and you get a sane and *existing* path.
> It would also be nice if TIniFile.Create didn't generate an Access
> Violation if the file can't be created.
>
> Should I open an issue on the bugtracker on this subject, or I'm the
> only one to think that it's a bug/required feature?
>
If I were you, I'd open an issue. I agree this is a problem.
More information about the fpc-pascal
mailing list