#76 XDG Base Directory Specification

1.4
closed
nobody
data (5)
fixed
5
2013-12-02
2011-12-22
mike
No

hi

On UNIX gpredict have hardcoded path to configuration files ($HOME/.config/Gpredict/) but if $XDG_CONFIG_HOME is set, path should be $XDG_CONFIG_HOME/Gpredict/.

Discussion

  • Charles Suprin

    Charles Suprin - 2011-12-22

    It looks as though GLib already has a function for this in the form of g_get_user_config_dir (). <http://developer.gnome.org/glib/2.30/glib-Miscellaneous-Utility-Functions.html#g-get-user-config-dir>

    This is a clear solution for unix machines. Less clearly this looks like the right solution for windows as well. For the macintosh platform, it is not clear at all if this is the correct approach. It looks a though it should be. The reference to gtk-osx seems to have passed in time.

    A patch for the unix machines is attached.

     
  • Charles Suprin

    Charles Suprin - 2011-12-22

    patch for g_get_user_config_dir

     
  • Charles Suprin

    Charles Suprin - 2011-12-22

    Related Question
    Should we honor $XDG_CACHE_HOME for the tle-updates?

     
  • mike

    mike - 2011-12-23

    It's goot idea.
    and can move the gpredict.log file in $XDG_CACHE_HOME also?

     
  • Charles Suprin

    Charles Suprin - 2011-12-24

    I am reluctant to put a log in a cache directory. The question with the spec is how "critical" a log file is.

     
  • mike

    mike - 2011-12-26

    ok. what about the tle-updates?

     
  • Alexandru Csete

    Alexandru Csete - 2011-12-26
    • status: open --> open-later
     
  • Alexandru Csete

    Alexandru Csete - 2011-12-26

    Hi guys,

    I have no problem with using g_get_user_config_dir() to get the top level directory, though there are few potential issues I'd like to understand before making the change. I hope we all agree that a situation where gpredict "forgets" its settings is unacceptable. Maybe I'm just a control freak, but it scares the hell out of me to let somebody else decide where gpredict should store its configuration.

    I'm confused about the applicability of this standard. The Freedesktop index pages says: "Desktop base directory spec details how desktops should locate files at runtime" - gpredict is neither a desktop nor part of or bound to any desktop. It should work well on any desktop and it must be able to remember the settings also when the user switches from one desktop to another.

    Who determines what $XDG_CONFIG_HOME is? Is the user? Is it the desktop? Is it the distribution?

    Is there a standard way of setting $XDG_CONFIG_HOME so that it is available regardless of what desktop the user is running?

    As for the log files and temporary tle data, they will stay where they are. I want to keep everything in one place, at least for now.

    PS: I can't help but notice the number of official KDE, Gnome 3 and Ubuntu desktop components that just throw their configuration in the users home...

     
  • Charles Suprin

    Charles Suprin - 2011-12-26

    I am not sure what you mean by the term "forgets".

    If by "forgets" you mean when the user upgrades to 1.4(or whenever this makes it in) the user loses their configuration information, the yes, I agree.

    If however you mean when the user sets or changes the $XDG_CONFIG_HOME environment variable that the configuration information is lost is a bad thing, then I disagree. For debugging purposes it is nice to be able to swap out .config/Gpredict directories. If someone has a bad configuration, it is a chance to test resetting the configuration without sending them poking into the .config directory. It is also nice if someone has a directory that causes a crash, it can be sent for analysis.

    As to whether this was the appropriate directory, I thought Gpredict chased gnome standards. Gnome appears to have adopted this, see <http://live.gnome.org/GnomeGoals/XDGConfigFolders>. It is not clear how urgent they feel about it.

    As to the setting of the $XDG_CONFIG_HOME variable, it generally appears unset by default. (This places the files right where they live now in ~/.config for unix machines.) This I assume would leave it to the user.

    As for the temporary tle data, I would like to move it to the cache directory for one reason, flash drives. Personally and others I know run systems that use compact flash as the permanent media. We try hard to move temp files and other things to ram drives to eliminate wear on the media. This would move it to "standards compliant" location.

    My concern is that the glib functions that implement this and the basedir spec are not as cross platform as one would like. Right now there is a conversation on the wisdom of having colons in file names. Unfortunately windows (c:\) and old Macintosh paths have colons in them. I am watching to see how this shakes out.

     
  • Alexandru Csete

    Alexandru Csete - 2011-12-26

    I meant when upgrading and if $XDG_CONFIG_HOME is set to something else than the default we see on our computers. This led to the question who is supposed to / allowed to change this. If the user messes with $XDG_CONFIG_HOME it's his problem. Are desktops and / or distribution using this to control where configuration is stored. Probably not, but we need to have some idea about it.

    Gpredict has no relation to Gnome. Early versions used some gnome widgets but that has been eliminated many years ago.

     
  • Charles Suprin

    Charles Suprin - 2011-12-26

    Based on a quick examinations of my machines, no distribution seems to set it. If they start setting it the they will have problems with plenty of other applications so it seems unlikely they would move it.

    Centos 6 does not define it
    Debian 5 does not define it.
    Debian 6 does not define it.
    Fedora 16 does not define it.
    Fedora 15 does not define it.
    Opensuse 12.1 does not define it
    OpenSuse 11.4 does not define it.
    OpenSuse 11.3 does not define it.
    Opensuse 11.3 does not define it.

     
  • Alexandru Csete

    Alexandru Csete - 2012-02-04
    • status: open-later --> open-fixed
     
  • Alexandru Csete

    Alexandru Csete - 2013-02-04
    • Milestone: SVN --> v1.4
     
  • Alexandru Csete

    Alexandru Csete - 2013-02-04
    • Status: open-fixed --> fixed
     
  • Alexandru Csete

    Alexandru Csete - 2013-02-04
    • labels: Data files --> data
    • status: fixed --> closed
    • resolution: --> fixed
     

Log in to post a comment.