Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2005-11

GetAppConfigDir under Unices

7 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Michalis Kamburelis

Hi

I just tested SysUtils.GetAppConfigDir under Linux and I see that it returns
GetHomeDir + ApplicationName
(when Global = false). Shouldn't it rather return
GetHomeDir + '.' + ApplicationName
? Config directories in user's home dir traditionally start with '.' to be somewhat "hidden". I would expect GetAppConfigDir to follow this practice.

Michalis

Reply by email

Michael Van Canneyt
to Michalis Kamburelis
Michalis Kamburelis wrote 8 lines
Hi I just tested SysUtils.GetAppConfigDir under Linux and I see that it returns GetHomeDir + ApplicationName (when Global = false). Shouldn't it rather return GetHomeDir + '.' + ApplicationName ? Config directories in user's home dir traditionally start with '.' to be somewhat "hidden". I would expect GetAppConfigDir to follow this practice.

It should. I'll have a look at it, thanks for reporting this.

Michael.

Reply by email

dannym
to Michalis Kamburelis: Hi I just tested SysUtils.GetAppConfigDir under Linux and I see that it returns…

Hi,

Michalis Kamburelis wrote 10 lines
Hi I just tested SysUtils.GetAppConfigDir under Linux and I see that it returns GetHomeDir + ApplicationName (when Global = false). Shouldn't it rather return GetHomeDir + '.' + ApplicationName ? Config directories in user's home dir traditionally start with '.' to be somewhat "hidden". I would expect GetAppConfigDir to follow this practice.

actually by now it is (among others) GetHomeDir + '/.config/' + ApplicationName, according to the Desktop Base Directory Spec

"$XDG_CONFIG_HOME defines the base directory relative to which user specific configuration files should be stored. If $XDG_CONFIG_HOME is either not set or empty, a default equal to $HOME/.config should be used."
http://standards.freedesktop.org/basedir-spec/basedir-spec-0.6.html

I guess someone died the death of a thousand dotfiles, and figured that it can't continue like that :)

Michalis

cheers,
Danny

Reply by email

Michael Van Canneyt
to dannym
dannym wrote 25 lines
Hi, Am Freitag, den 04.11.2005, 05:46 +0100 schrieb Michalis Kamburelis: > Hi > > I just tested SysUtils.GetAppConfigDir under Linux and I see that it > returns > GetHomeDir + ApplicationName > (when Global = false). Shouldn't it rather return > GetHomeDir + '.' + ApplicationName > ? Config directories in user's home dir traditionally start with '.' to > be somewhat "hidden". I would expect GetAppConfigDir to follow this > practice. actually by now it is (among others) GetHomeDir + '/.config/' + ApplicationName, according to the Desktop Base Directory Spec "$XDG_CONFIG_HOME defines the base directory relative to which user specific configuration files should be stored. If $XDG_CONFIG_HOME is either not set or empty, a default equal to $HOME/.config should be used." http://standards.freedesktop.org/basedir-spec/basedir-spec-0.6.html I guess someone died the death of a thousand dotfiles, and figured that it can't continue like that :)

Hm.
Do you know a distro that uses this ?
SuSE definitely doesn't. The .config directory doesn't even exist.

Also, most existing apps don't adhere to this, but use the scheme as
outlined in FPC. so..;

Michael.

Reply by email

dannym
to Michael Van Canneyt

Hi,

Michael Van Canneyt wrote 32 lines
On Fri, 4 Nov 2005, dannym wrote: > Hi, > > Am Freitag, den 04.11.2005, 05:46 +0100 schrieb Michalis Kamburelis: >> Hi >> >> I just tested SysUtils.GetAppConfigDir under Linux and I see that it >> returns >> GetHomeDir + ApplicationName >> (when Global = false). Shouldn't it rather return >> GetHomeDir + '.' + ApplicationName >> ? Config directories in user's home dir traditionally start with '.' to >> be somewhat "hidden". I would expect GetAppConfigDir to follow this >> practice. > > actually by now it is (among others) GetHomeDir + '/.config/' + > ApplicationName, according to the Desktop Base Directory Spec > > "$XDG_CONFIG_HOME defines the base directory relative to which user > specific configuration files should be stored. If $XDG_CONFIG_HOME is > either not set or empty, a default equal to $HOME/.config should be > used." > http://standards.freedesktop.org/basedir-spec/basedir-spec-0.6.html > > I guess someone died the death of a thousand dotfiles, and figured that > it can't continue like that :) Hm. Do you know a distro that uses this ? SuSE definitely doesn't. The .config directory doesn't even exist.

I doubt that that is dictated by a distro. The spec is pretty recent, so I guess not many apps use it yet. However,
- xfce 4.2 does use it
- the spec was written by a kde guy, and a quick search turned up http://wiki.kde.org/tiki-index.php?page=Environment+Variables (not too sure if they really use it, as I don't use kde)
- there are too many dotfiles in the way in $HOME :)

So, for new apps / new major versions, IMO adhering to the spec would be a better idea. For minor revisions of existing apps, yes, no use in breaking people's existing config files / making things break for them when they downgrade the app again.

Note that gnome and kde use a different level of indirection (.gnome2 / .kde) since ancient times, otherwise (everything directly in $HOME) one would drown in a ocean of dotfiles already :)

Show quoted text 5 lines
Also, most existing apps don't adhere to this, but use the scheme as outlined in FPC. so..; Michael.

cheers,
Danny

Reply by email

Michael Van Canneyt
to Michalis Kamburelis: Hi I had some time today and I decided to write a simple patch that fixes…
Michalis Kamburelis wrote 22 lines
Hi I had some time today and I decided to write a simple patch that fixes GetAppConfigDir, adhering to basedir-spec. The arguments after adhering to basedir-spec are: - The idea to place things within .config/ seems sensible. - On my system (Debian testing) I see two things that adhere to it (xfce4 and graveman), so the spec is not completely unknown. So my patch follows Danny's advice and adheres to basedir-spec. So GetAppConfigDir(false) and GetAppConfigFile(false, ...) behavior changes to use $XDG_CONFIG_HOME or ~/.config/. The patch also fixes GetAppConfigFile(false) behavior (ConfigExtension was not appended in this case). I'm attaching the patch to rtl/unix/sysutils.pp (done versus trunk, but I think it should be merged with 2.0.1 branch too) as file sysutils.patch, and I'm attaching a trivial test program test_app_config_dir.pas to easily test GetAppConfigXxx routines.

Applied, but not merged. The 2.0.2 tag is already set. It will be for 2.0.4.

Michael.

Reply by email

Michalis Kamburelis
to dannym: I doubt that that is dictated by a distro. The spec is pretty recent, so I guess not many…

Hi

I had some time today and I decided to write a simple patch that fixes GetAppConfigDir, adhering to basedir-spec.

The arguments after adhering to basedir-spec are:
- The idea to place things within .config/ seems sensible.
- On my system (Debian testing) I see two things that adhere to it (xfce4 and graveman), so the spec is not completely unknown.

So my patch follows Danny's advice and adheres to basedir-spec.

So GetAppConfigDir(false) and GetAppConfigFile(false, ...) behavior changes to use $XDG_CONFIG_HOME or ~/.config/. The patch also fixes GetAppConfigFile(false) behavior (ConfigExtension was not appended in this case).

I'm attaching the patch to rtl/unix/sysutils.pp (done versus trunk, but I think it should be merged with 2.0.1 branch too) as file sysutils.patch, and I'm attaching a trivial test program test_app_config_dir.pas to easily test GetAppConfigXxx routines.

Michalis

Reply by email