Support FreeDesktop.org XDG basedir specification

Bug #1088064 reported by Eric Heintzmann
28
This bug affects 4 people
Affects Status Importance Assigned to Milestone
Stellarium
Opinion
Wishlist
Unassigned

Related branches

Changed in stellarium:
importance: Undecided → Wishlist
status: New → Opinion
Revision history for this message
Alexander Wolf (alexwolf) wrote :

I committed support of .config/stellarium folder but IMHO this is very stupid standard.

Diff: http://bazaar.launchpad.net/~stellarium/stellarium/trunk/revision/5714

Changed in stellarium:
status: Opinion → Fix Committed
milestone: none → 0.12.0
Changed in stellarium:
assignee: nobody → Alexander Wolf (alexwolf)
Revision history for this message
Bogdan Marinov (daggerstab) wrote :

Alex, by know you should have learned that as a developer, you are supposed to show some discernment and judgment about changes to the code, not just blindly and hastily implement whatever is proposed by the latest bug report/feature request. I'm especially disturbed by the fact that you changed Stellarium's base directory structure - a rather significant change - without discussing it with other developers.

Bug status is changed to "Opinion" pending developer discussion. I'll revert Alex' incomplete implementation.

Changed in stellarium:
assignee: Alexander Wolf (alexwolf) → nobody
importance: Wishlist → Low
milestone: 0.12.0 → 1.0.0
status: Fix Committed → Opinion
Revision history for this message
Eric Heintzmann (heintzmann-eric) wrote :

Sorry

Alexander, I've looked at your patch. You should not harcode .config path in your code.
Instead you should read $XDG_CONFIG_HOME environment variable, and use it if defined and not empty.
If $XDG_CONFIG_HOME is not defined or it is empty, then you can default to $HOME/.config.

For CMAKE, the code should looks like to:

IF $ENV{XDG_CONFIG_HOME} is defined
    IF $ENV{XDG_CONFIG_HOME} is not empty
        SET(CMAKE_INSTALL_PREFIX $ENV{XDG_CONFIG_HOME}/stellarium)
    ELSE
        SET(CMAKE_INSTALL_PREFIX $ENV{HOME}/.config/stellarium)
    ENDIF
 ELSE
    SET(CMAKE_INSTALL_PREFIX $ENV{HOME}/.config/stellarium)
ENDIF

Revision history for this message
Eric Heintzmann (heintzmann-eric) wrote :

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 :
http://ploum.net/post/207-modify-your-application-to-use-xdg-folders
https://live.gnome.org/GnomeGoals/XDGConfigFolders

Full specification can be found at:
http://standards.freedesktop.org/basedir-spec/latest/

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 )
- LXDE
- Razor-qt
- 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
- Fedora
- Suse
- many more distributions

I think that Stellarium 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.

Revision history for this message
Alexander Wolf (alexwolf) wrote :

IMHO this specification is fully bullshit.

You are write about "real advantages":
- a lot less cluttered $HOME -- yes, "of course"; new specifications make more mess in users data files.
- Make backups a lot more safer and easier. -- I agree
- 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. -- I disagree, because for stellarium need use three different directories for storing users data instead one directory. Is this a "lot easier"?
- Avoid some strange bugs that happens because you had a old version of some configuration file -- And? I don't see how to new specification can be protect from "strange bugs".
- A lot more of flexibility and portability because no path are hardcoded. -- What? Do you mean using $HOME variable are more "hardcoded" tnan $XDG_* variables?

Revision history for this message
Eric Heintzmann (heintzmann-eric) wrote :

> - Make backups a lot more safer and easier. -- I agree
I think backup are the main reason to use XDG basedir spec.

>- 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. -- I disagree, because for stellarium need use three >different directories for storing users data instead one directory. Is this a "lot easier"?
Configuration file should be written in $XDG_CONFIG_HOME /stellarium. Thus you can reset your preferences just by deleting this dir without data loss (because you user data are saved in $XDG_DATA_HOME).

Revision history for this message
Alexander Wolf (alexwolf) wrote :

Hmm... Do you really mean that removing $XDG_CONFIG_HOME/stellarium/stellarium/config.ini more easily than removing $HOME/.stellarium/config.ini ? Do you really mean that using $XDG_DATA_DIRS/shares/stellarium/stellarium/stars/default/stars_4_1v0_0.cat more easily than use $HOME/.stellarium/stars/default/stars_4_1v0_0.cat ? We have also have logger for Stellarium running - Where should be log from Stellarium in XDG specification? Yes, XDG don't known about logs. Maybe we should use /var/log/stellarium.log or /var/log/stellarium/log.txt with superuser's access instead $HOME/.stellarium/log.txt?

Revision history for this message
Eric Heintzmann (heintzmann-eric) wrote :

I mean that it is more simple to remove $XDG_CONFIG_HOME/subdirFOR ALL APPS than guessing what files to remove.
I mean than using $XDG_DATA_DIRS/ FOR ALL APPS is more easily than hunting files in $HOME.

For logs you should use syslog/systemd instead.

Revision history for this message
Alexander Wolf (alexwolf) wrote :

Hmm... Very good way for solve problem in one application - just kill settings for ALL applications. I think better way will be run rm -rf / for solve all problems.

We will never support systemd because systemd is linux-only bullshit which written Lennart Poettering.

Revision history for this message
Eric Heintzmann (heintzmann-eric) wrote :

>Very good way for solve problem in one application - just kill settings for ALL applications.
You can just reset preferences for ONE application, just by removing ONE subdir (and without data loss, I repeat).
You don't have to guess what file to remove, just knowing the app name which is the subdir name.

>We will never support systemd because systemd is linux-only bullshit which written Lennart Poettering.
In this case, you can use syslog.

Changed in stellarium:
importance: Low → Wishlist
Changed in stellarium:
milestone: 1.0.0 → none
Revision history for this message
Alexander Wolf (alexwolf) wrote :
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.