[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Paths in the default mame config file



On 31/10/12 15:01, Emmanuel Kasper wrote:
> A is an optional user-supplied configuration file.

There are general moves towards following the freedesktop.org XDG Base
Directory specification for configuration (both in GNOME and in, e.g.,
git): write to a non-hidden subdirectory of ${XDG_CONFIG_HOME}
(defaulting to ~/.config if unset) and read from either the first
instance of that subdirectory in an element of
${XDG_CONFIG_HOME}:${XDG_CONFIG_DIRS} (defaulting to ~/.config and
/etc/xdg, respectively, if unset), or the union of those subdirectories.

I believe modern KDE, XFCE etc. use the same specification.

If the MAME (upstream) developers are willing to handle XDG_CONFIG_HOME
according to the XDG Base Directory specification, great. If not, I
personally think that using ~/.mame is better than hard-coding ~/.config
without respecting the corresponding environment variables.

If MAME uses GLib, it can use g_get_user_config_dir() and
g_get_system_config_dirs() (which also give vaguely sensible non-XDG
answers on Windows). I'm sure other runtime libraries analogous to GLib
have an equivalent.

> B are the ROMS and other ressources (artwork,cheat files) needed for the
> program to be useful. These files *need* to be provided by the user.

In modern GNOME, user-visible files often go in an "XDG special
directory" whose location is user-settable. These are equivalent to
stuff like "My Documents" under Windows (but in Windows you edit the
Registry to change their locations, whereas in GNOME you edit a text
file or set an environment variable). In GLib, these come from
g_get_user_special_dir().

The defaults are ~/Desktop, ~/Downloads, ~/Templates, ~/Public,
~/Documents, ~/Music, ~/Pictures and ~/Videos, but they are configurable
by setting your locale (non-English installs will get localized defaults
if xdg-user-dirs has been translated), setting $XDG_DESKTOP_DIR and
similar variables, or editing ${XDG_CONFIG_HOME}/user-dirs.dirs.

I believe modern KDE, XFCE etc. use the same specification.

Having said that, I've seen GNOME apps use a non-hidden, non-XDG default
for user-visible-but-automatically-created things - GNOME Boxes (a
virtual machine manager) uses ~/VirtualMachines.

I'm not sure I'm really happy about that... I think the space of
non-hidden filenames in $HOME "belongs to" the user. It's not too bad if
it's straightforward to change the default via an obvious GUI. In GNOME,
renaming the "special directories" in Nautilus automatically rewrites
user-dirs.dirs - I'm not sure how VirtualMachines is handled, though.

> C are for instance saved games data. These files are autogenerated by
> mame itself without user intervention.

These increasinly also follow the XDG Base Directory specification:
write to a non-hidden subdirectory of ${XDG_DATA_HOME} (defaulting to
~/.local/share) and read from ${XDG_DATA_HOME}:${XDG_DATA_DIRS}
(defaulting to ~/.local/share and /usr/local/share:/usr/share,
respectively). In GLib, g_get_user_data_dir() and
g_get_system_data_dirs() query these, and also give vaguely sensible
answers on at least Windows.

Like ~/.config, if the MAME (upstream) developers are willing to handle
~/.config according to the XDG Base Directory specification, great; but
if not, I personally think using ~/.mame is better than hard-coding
~/.local/share without respecting the corresponding environment variables.

There is a fourth category you haven't mentioned: caches which can
safely be deleted at any time and do not need to be backed up, which go
in ${XDG_CACHE_HOME} (defaulting to ~/.cache). In GLib, that's
g_get_user_cache_dir().

> A is always a dot file either ine the form of .myfoorc or .myfoo/myfoorc [1]

... or increasingly, ${XDG_CONFIG_HOME}/myfoo/myfoorc or something.

> C is almost always in a .myfoo directory ( examples I think of:
> Thunderbird, Pidgin, Empathy mails and chat logs)

Empathy logs to ${XDG_DATA_HOME}/Empathy/logs these days.

> Stuff created by Gnome itself that a normal user should not tamper is
> stored in .private or .gconf (IIRC again)

... or ${XDG_DATA_HOME}, now.

~/.gconf is actually configuration (your category A), not user data
(your category C). Its modern equivalent is ${XDG_CONFIG_HOME}/dconf.

    S


Reply to: