[Lazarus] GetAppConfigFileUTf8

Reinier Olislagers reinierolislagers at gmail.com
Mon Jun 25 18:14:54 CEST 2012


Suppose I'm using
FConfigFileName:=GetAppConfigFileUTF8(false);
to get a config file for my application.

The help for GetAppConfigFile says you can't rely on the file/directory
being there so I assumed it would be the same for the UTF8 version.

On Windows Vista, no problems. A user with XP says the directory
C:\Documents and Settings\<username>\Local Settings\Application
Data\<application name>
didn't exist.
Once he created the <application name> directory, it worked.

I changed the code to this:
  // Make sure the directory exists. Let's hope
  // GetappConfigDirUTF8 and the file version give the same directory.
  ForceDirectoriesUTF8(GetAppConfigDirUTF8(false));
  FConfigFileName:=GetAppConfigFileUTF8(false);

... is this how it is supposed to work?

Wouldn't it be easier to have another function that just gives a
guaranteed to exist filename?




More information about the Lazarus mailing list