Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo
We store information in ~/.scummvm. It would be better to use the locations defined in the XDG Base Directory Specification.
Well, ~/.* is the Right Thing(TM), Unix style, and 99.95% of programs use that. Gnome works mainly on *nix clones. I see no point of moving it anywhere.
What are the advantages specific to our project? None of the things mentioned in the list you point to are applicable to ScummVM. E.g. it is safe to kill this file anytime, it is universal, backing it up = copy single file, data file paths are specified via GUI and are not enforced by the program, etc.
William Jon McCann
Storing in $HOME is no longer the Right Thing(TM) on any unix style machine. This has nothing to do with GNOME. In fact this standard supports not only unix style systems but also mac and windows in most implementations. The GLib apis are particularly good in this respect.
The advantages are for the user and admin, mostly. Not necessarily your project. Just being considerate to your users and a good citizen of the ecosystem I suppose. I don't think it really involves any cost. I can provide a patch myself soon I hope.
Does it mean that reading XDG_CONFIG_HOME environment variables is enough?
Looking into glib sources, I see that if this variable is not set, it uses ~/.config, however the specifications mention /etc/xdg directory. So there is an inconsistency.
Also this variable is not set neither on my Ubuntu 12.04 (with Unity), nor on Mac OS 10.7.4.
Adding dependency on glib for the sake of retrieving this value looks like an overkill for me.
So, any suggestions or hints?
William Jon McCann
XDG_CONFIG_HOME and XDG_CONFIG_DIRS are different. The first is per-user and typically in the home directory. The second is systemy typically.
The variable isn't normally set because the default is usually correct. However, a system admin or vendor can set it to whatever they wish. This is sometimes done when multiple operating systems need to be supported using a shared home directory.
So, from a quick look it seems that dot files are used for a few things.
log files -> syslog or XDG_CACHE_HOME/scummvm
saved games -> XDG_DATA_HOME/scummvm/
configuration -> XDG_CONFIG_HOME/scummvm
One nice thing about glib (there are lots of nice things about glib) is that it takes care of windows support for you. But if you don't want to add a dependency on it you can just do the same things that it does. g_get_user_cache_dir() for example.
Hope that helps.
I did some digging to find this out since some other games are putting their saves in ~/Documents/
Basically shell scripts are supposed to check for and source ~/.config/user-dirs.dirs (they should look for $XDG_CONFIG_HOME and fall back to ~/.config)
Then they'll get the environment variables.
Stuff that runs at logs uses /etc/xdg to populate that file.
(~/.config is the default for XDG_CONFIG_HOME)
Implementing this shouldn't be too hard and ScummVM could probably fall back to the old behavior if anything goes wrong.
Migration is a different story.
William Jon McCann
Just curious, what games? Using Documents sounds wrong to me. I think using USER_DATA_HOME is better.
botanicula is the game but that's besides the point.
The environment variables for xdg in debian sid are the following:
There is no USER_DATA_HOME that I can see
Ok, I'll try to follow up with that game and file a bug. Thanks for that info.
"$XDG_DATA_HOME defines the base directory relative to which user specific data files should be stored. If $XDG_DATA_HOME is either not set or empty, a default equal to $HOME/.local/share should be used. "
I agree that adding glib as dependancy is really a bit much. Especially for using it on Windows, where it seemed a PITA to build it easily with MSVC. At least I had some troubles when I tired to do an x64 build. But that has been a while, so maybe it's better these days.
As I understand it the base-dir specification was made to declutter $HOME and give some standard paths for different types of files used by programs on desktop machines. Then again the whole specification fails to point out any benefits, so maybe the intention here was something completly different... So I am not really sure I can say I like it too much. It would really be better when it would at least point to other documents which points out why using $HOME etc. is bad for example.
It might make sense to adpot that standard never the less, looking at my $HOME/.local/share and $HOME/.config more and more programs seem to adopt it. The proposed places to put the config file, saved games seem fine to me. I am not sure whether I feel that "XDG_CACHE_HOME" sounds really a place to put a log, but I guess from the specification it seems the place which fits best.
Anyway we need to make sure people with config files etc. in the old locations don't need to manually migrate to the new locations IMHO. That might need some small effort.
This bug is nice to get fixed before the release. Raising priority for keeping the track.
What is planned now about FreeDesktop XDG basedir specification for ScummVM?
As it seems, there's currently nobody working on that.
According to XDG Base directory specification:
User data should go into $XDG_DATA_HOME (which default to ~/.local/share),
user preferences should go into $XDG_CONFIG_HOME (which default to ~/.config)
and cached data should go to $XDG_CACHE_HOME (which default to ~/.cache).
More details at :
Full specification can be found at:
The Freedesktop.org XDG base directory specification have good de facto adoption.
It has been adopted by:
- GNOME ( https://live.gnome.org/GnomeGoals/XDGConfigFolders )
- GTK+ ( https://bugzilla.gnome.org/show_bug.cgi?id=646631 )
- KDE ( http://techbase.kde.org/KDE_System_Administration/XDG_Filesystem_Hierarchy#Freedesktop.org_and_Standard_Directories )
- QT ( http://harmattan-dev.nokia.com/docs/library/html/qt4/qsettings.html#setPath )
- XFCE ( http://docs.xfce.org/xfce/xfce4-session/advanced in Files and Environment Variables )
- VLC ( https://trac.videolan.org/vlc/ticket/1267 )
- GStreamer ( https://bugzilla.gnome.org/show_bug.cgi?id=518597 )
- Chrome ( http://code.google.com/p/chromium/issues/detail?id=16976 )
- many more upstream applications
- Ubuntu ( http://brainstorm.ubuntu.com/idea/6557/ & http://packages.ubuntu.com/fr/source/precise/libxdg-basedir )
- Debian ( http://packages.debian.org/squeeze/libxdg-basedir1 )
- Red Hat
- many more distributions
I think that ScummVM should use same locations than the vast majority of Desktop environment and applications.
There are real advantages of following this specification :
- a lot less cluttered $HOME
- Make backups a lot more safer and easier.
Backuping your $XDG_DATA_HOME along with your files is enough
(or just excluding $XDG_CACHE_HOME)
- A lot easier to reset a default configuration if you want/need it (and
without any risk to loose informations). Even for the software itself
could choose to reset $XDG_CONFIG_HOME if needed.
- Avoid some strange bugs that happens because you had a old version of
some configuration file
- A lot more of flexibility and portability because no path are hardcoded.