Modify your application to use XDG folders
Par Ploum, mercredi 11 mars 2009 à 23:38 :: gnome, hacker vaillant, usability :: #207 :: rss
As I previously pointed out, there's a huge need to have a clear distinction between the user preferences and the user data. This is already covered by the FreeDesktop XDG folders specification.
Amongst the advantages of following this specification, I list :
- a lot less cluttered $HOME (my mother will not cry anymore when the gtk file selector randomly choose to display hidden folders)
- Make backups a lot more safer and easier. (you know that backuping your $XDG_DATA_HOME along with your files is enough)
- 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. You use the XDG library that does the job for you. If you don't want the dependency, implementing the XDG specification is only a few lines of code.
How does it work ?
Your application should not have its own folder anymore (and should not use another software hidden folder like .gnome2).
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).
Of course, there's no need to read the environment variable yourself : most language provide a library to use XDG folder. For example a patch for a GTK application or one for a python application.
But how do you know what goes in what folder ?
There's a little trick : just imagine that it was deleted. What would you think as a user ?
If you would cry, running frenetically to your backup, it means that it belongs to XDG_DATA_HOME.
If you would think "Damn, I will have to reconfigure all", it belongs to $XDG_CONFIG_HOME. This includes user installed plugins even if those plugins might themselves have files in XDG_DATA_HOME. The exception I see is the usernames/passwords for external services. Those are clearly configuration stuffs but, imho, just fit better in XDG_DATA_HOME.
If you would just think "It's bloody slow those days" then it is obviously part of XDG_CACHE_HOME.
Of course, I'm sure there is some corner cases. But take the time to choose carefully instead of just putting everything in XDG_DATA_HOME, defeating the purpose of this specification.
Think about your users !
A lot of applications are already following this specification (VLC, Wormux, Totem, Metacity, Cheese, Deskbar, Pyroom, Getting Things Gnome) or will soon (Rhythmbox has it in SVN, GStreamer will have it for 0.11,..)
GNOME projects are listed in the tracking bug and you can help to complete the Gnome goal proposition.
And you ? Is your application already XDG compliant ?
PS : If you are not the maintener of any applications, sending a patch to your favourite project might be a great contribution. If you never contributed code to any project, take this opportunity : writing a XDG patch is really easy to do and it could be your first step to world domination.
- Send to friend -





Commentaires
1. Le jeudi 12 mars 2009 à 01:09, par antistress :: site
2. Le jeudi 12 mars 2009 à 01:54, par Robin :: site
3. Le jeudi 12 mars 2009 à 02:34, par Stefano F. (tacone) :: site
4. Le jeudi 12 mars 2009 à 04:33, par Paul Kishimoto :: site
5. Le jeudi 12 mars 2009 à 06:17, par Philip Paeps :: site
6. Le jeudi 12 mars 2009 à 06:19, par Philip Paeps :: site
7. Le jeudi 12 mars 2009 à 09:28, par Ploum :: site
8. Le jeudi 12 mars 2009 à 11:42, par Colin :: site
9. Le jeudi 12 mars 2009 à 11:50, par Stefano F. (tacone) :: site
10. Le jeudi 12 mars 2009 à 11:58, par Ploum :: site
11. Le jeudi 12 mars 2009 à 13:33, par Alexandre Franke :: site
12. Le jeudi 12 mars 2009 à 13:55, par Ploum :: site
13. Le jeudi 12 mars 2009 à 17:26, par Philip Paeps :: site
14. Le jeudi 12 mars 2009 à 17:37, par Philip Paeps :: site
15. Le jeudi 12 mars 2009 à 17:40, par Ploum :: site
16. Le jeudi 12 mars 2009 à 18:17, par Diego :: site
17. Le jeudi 12 mars 2009 à 18:48, par ploum :: site
18. Le vendredi 13 mars 2009 à 12:46, par tamagnitamarico.com :: site
19. Le dimanche 15 mars 2009 à 23:34, par staz
20. Le lundi 16 mars 2009 à 11:48, par PomCompot
21. Le lundi 23 mars 2009 à 18:35, par Mats Taraldsvik
22. Le mardi 24 mars 2009 à 15:42, par Cristi
23. Le mardi 24 mars 2009 à 19:23, par Mats Taraldsvik
24. Le mercredi 25 mars 2009 à 12:58, par Cristi
25. Le lundi 20 avril 2009 à 20:51, par Silver Knight
26. Le mardi 19 mai 2009 à 10:58, par Sławek
27. Le mardi 19 mai 2009 à 11:03, par Sławek
28. Le jeudi 30 juillet 2009 à 00:57, par antistress :: site
29. Le jeudi 10 septembre 2009 à 01:06, par antistress :: site
30. Le jeudi 10 septembre 2009 à 16:23, par antistress :: site
31. Le samedi 12 septembre 2009 à 14:44, par antistress :: site
32. Le samedi 31 octobre 2009 à 03:28, par anon
33. Le jeudi 5 novembre 2009 à 04:04, par James :: site
34. Le mercredi 16 juin 2010 à 15:17, par Muflone :: site
35. Le mercredi 7 juillet 2010 à 10:44, par vacheron constantin watch :: site
36. Le samedi 17 juillet 2010 à 15:22, par ipad converter :: site
37. Le dimanche 1 août 2010 à 09:26, par pool maintenance :: site
38. Le mercredi 4 août 2010 à 06:08, par Wyler replica watches :: site
39. Le mardi 10 août 2010 à 11:42, par rhinoplasty orange county :: site
40. Le samedi 14 août 2010 à 07:35, par Gucci handbags :: site
41. Le samedi 14 août 2010 à 15:40, par step up 3d download :: site
42. Le dimanche 15 août 2010 à 09:54, par If I'm not wrong, the article was about the rapid change in the government. The media also has reported something related to the country. :: site
43. Le dimanche 15 août 2010 à 09:56, par Exotic rental car Miami :: site
44. Le jeudi 19 août 2010 à 07:34, par UGG :: site
45. Le jeudi 19 août 2010 à 22:41, par Laser Hair Removal Aliso Viejo :: site
46. Le jeudi 19 août 2010 à 22:42, par Laser Hair Removal Aliso Viejo :: site
47. Le vendredi 20 août 2010 à 10:28, par coach sneakrs
48. Le lundi 23 août 2010 à 10:04, par omega watches :: site
49. Le lundi 23 août 2010 à 12:20, par gucci handbag :: site
50. Le mardi 24 août 2010 à 05:19, par timberland 6 inch :: site
51. Le mardi 24 août 2010 à 05:55, par omega watches :: site
52. Le mercredi 25 août 2010 à 06:21, par quinceanera dresses :: site
53. Le jeudi 26 août 2010 à 14:56, par Types of turtles :: site
54. Le lundi 30 août 2010 à 02:55, par fm stereo transmitter :: site
55. Le mardi 31 août 2010 à 08:13, par ugg boots london :: site
56. Le mercredi 1 septembre 2010 à 08:38, par gucci 211137 :: site
57. Le jeudi 2 septembre 2010 à 05:38, par wholesale nike shoes :: site
58. Le jeudi 2 septembre 2010 à 15:54, par Swiss made replica watches :: site
Ajouter un commentaire
Poster un commentaire n'est pas une obligation. Rappelez-vous de tourner 7 fois votre clavier dans votre bouche avant de poster (oui, il m'a fallu des années de streching pour y arriver).
Si votre commentaire a été effacé, c'est sans doute pour une de ces raisons.