Store data in XDG user directories

Bug #647608 reported by Jeff Fortin Tam
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Recipe Manager
Fix Committed
High
Jeff Fortin Tam

Bug Description

As this project's still young/obscure at the moment, I guess now is the time to make sure that we get the user data directory locations "done right" from the start. What I'm referring to is this Freedesktop spec: http://standards.freedesktop.org/basedir-spec/latest/
Especially: http://standards.freedesktop.org/basedir-spec/latest/ar01s03.html

I first heard about the xdg desktop dirs thing through this post, which does a good job at explaining the issue/challenges that this spec addresses: http://ploum.frimouvy.org/?184-cleaning-user-preferences-keeping-user-data

See also: http://ploum.frimouvy.org/?207-modify-your-application-to-use-xdg-folders

In our case, I think the only data we write is the recipes themselves (preferences are done in gconf). Thus, we could store recipes in $XDG_DATA_HOME/recipemanager/recipes/ and $XDG_DATA_HOME/recipemanager/photos/

... with their respective fallbacks (as described in the specs), of course. Here is an example implementation in Python, which tries to use the environment variables and falls back on hardcoded paths otherwise (I don't know if there's a more elegant way):

http://bazaar.launchpad.net/~specto/specto/main/annotate/head:/spectlib/util.py
(the get_path method, between lines 53 and 91).

Related branches

Jeff Fortin Tam (kiddo)
Changed in recipe-manager:
milestone: none → 0.4
Revision history for this message
Jeff Fortin Tam (kiddo) wrote :

I have implemented it (ridiculously easy with python-xdg), but then the use of default.jpg all over the place in the code is causing problems with the fact that it "expects" it to be present in the same directory as the user's photos data...

I'll have to figure out a way to cleanly point to a different path in case the user has not specified a photo.

Changed in recipe-manager:
assignee: nobody → Jean-François Fortin Tam (kiddo)
status: Confirmed → In Progress
Jeff Fortin Tam (kiddo)
Changed in recipe-manager:
status: In Progress → Fix Committed
Revision history for this message
Daniel G. Taylor (danielgtaylor) wrote :

Merged into trunk. This means running from a directory no longer works to show the default data - let's try and pick a default recipe to always install when creating the XDG directories so users don't just see a crappy blank window!

Revision history for this message
Jeff Fortin Tam (kiddo) wrote :

Well, interestingly enough, I thought you kinda considered that a feature :)
... at least, according to an email you sent me initially, saying you wanted to pull out the built-in recipes.

Now that import/export works, it might indeed be useless to bundle them with the app if we set up a website with a few pre-made recipes (could be simply a directory listing with various .recipe files we have made, or could eventually be a nicely integrated service thing as https://blueprints.launchpad.net/recipe-manager/+spec/online-service suggests).

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

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