[Lazarus] Configuration data in Linux?

Thierry Bothorel thierry.bothorel at gmail.com
Thu Sep 30 00:31:25 CEST 2010


Žilvinas Ledas a écrit :
>
> On 2010-09-28 09:24, Bo Berglund wrote:
>> So can I get some advice on:
>> - What is the common way to store config data on Linux?
>>    Ini files are probably not used since they are Windowsisms,
>>    but is there some other easily used way where one can simply
>>    store and retrieve individual values without scanning through
>>    a text file?
>>
>> - Where is the agreed location for such data?
>>
> In Lazarus you can use:
> function GetAppConfigDirUTF8(Global: Boolean): string;
> function GetAppConfigFileUTF8(Global: Boolean; SubDir: boolean =
> false): string;
>
> to get correct config dir/file name in (various versions of)
> windows/linux/osx.
>
I find GetAppConfigDir strange on Linux :

GetAppConfigDir(True) gives /etc/project1/ for directory, it's OK, but
we can assume the config file is UNDER this directory, but 
GetAppConfigFile(True) gives /etc/project1.cfg , not
/etc/project1/project1.cfg
So we can't use this function the same way on Windows XP because
GetAppConfigFile(True) gives
C:\D&S\user\Local Settings\Application Data\project1\project1.cfg
, not C:\D&S\user\Local Settings\Application Data\project1.cfg

Thierry B.




More information about the Lazarus mailing list