[Lazarus] Configuration data in Linux?
Sven Barth
pascaldragon at googlemail.com
Tue Sep 28 10:18:56 CEST 2010
Am 28.09.2010 08:24, schrieb Bo Berglund:
> - 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?
You can basically use everything you want. If you want your user to edit
them manually (using a text editor, etc) you should use a text format
like XML, INI, YAML, JSON, etc.
If you don't need that your user plays around with the config you can
also use binary formats like a SQLite database (might be overkill of
course, but the option is there ^^)
> - Where is the agreed location for such data?
As the others already said is the global config in "/etc" or
"/usr/local/etc" and the per user configuration in his/her home
directory as a hidden file or directory.
You can look at the following functions from SysUtils to make your life
easier:
http://www.freepascal.org/docs-html/rtl/sysutils/getappconfigdir.html
http://www.freepascal.org/docs-html/rtl/sysutils/getappconfigfile.html
>
> - And in fact where is the agreed location for the programs
> themselves?
Normally (there are some distros which differ from this standard) the
layout is the following:
/etc - the global configuration files (read only by normal users)
/home/XYZ/.bla - the per user configuration files
/usr/bin - the application binary
/usr/share/bla - other shared data (like images, sounds, etc) of your
application
/usr/docs/bla - the documentation for your application
Please note: "/usr" can also be replaced by "/opt". The difference is
this: in "/usr" there should be all applications installed by the
distros package manager while "/opt" contains applications that are
installed by other means (custom installers, etc).
Please keep in mind that this layout is not necessarily set in stone.
Some distros take different approaches to it.
Regards,
Sven
More information about the Lazarus
mailing list