Am 28.09.2010 10:42, schrieb Bo Berglund:
So to summarize there *is* a convention on the file location depending
on if the data are user specific or global. The name of the file is
the application name preceded by a period. No extension.

Not exactly.

E.g.
- FPC uses a .fpc.cfg in your home directory
- Lazarus uses the directory .lazarus by default
- Firefox has its own directory in .mozilla/firefox

You are rather free here. The functions Žilvinas and I mentioned are returning a filename or a directory name (depending on the called function) in the .config directory (which is also used by other applications as well).

But there is no convention regarding the format of this file apart
from it being in ASCII only.

Not even that is a convention. As said you can use what you see fit. You can also use UTF-8 files or binary files (altough the user can't edit the seconds ones if you don't provide the tools for them).


So I could create an IniFile class to handle the config and let it
have methods for reading/writing private and global config data into a
file which it determines by itself depending on its call. Then I would
be doing the right thing? I could use the format of windows ini files
(which we are accustomed to) and still be OK on Linux...

But don't forget that the global config in "/etc" is normally read only. You should only create it during the installation phase (which is done by a administrator/root account and thus has the needed rights.

Sidenote: You can use the GetAppConfigDir/File functions on Windows as well and they will return you the directories where an applications should put it's configuration data normally (instead of the program directory).

Regards,
Sven

--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to