After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 598102 - Don't harcode cache configuration in ~/.gnome2/shell
Don't harcode cache configuration in ~/.gnome2/shell
Status: RESOLVED DUPLICATE of bug 617555
Product: gnome-shell
Classification: Core
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: gnome-shell-maint
gnome-shell-maint
Depends on:
Blocks: 523057
 
 
Reported: 2009-10-11 19:15 UTC by Baptiste Mille-Mathias
Modified: 2010-05-09 04:41 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Use XDG compliant directory for storing config (936 bytes, patch)
2009-10-11 19:15 UTC, Baptiste Mille-Mathias
needs-work Details | Review

Description Baptiste Mille-Mathias 2009-10-11 19:15:56 UTC
Please find hereunder a patch to use the XDG defined directory. I used the cache directory because the information stored are not configuration but only status of application windows.
Comment 1 Baptiste Mille-Mathias 2009-10-11 19:15:59 UTC
Created attachment 145252 [details] [review]
Use XDG compliant directory for storing config
Comment 2 Colin Walters 2009-10-13 16:17:54 UTC
Review of attachment 145252 [details] [review]:

::: src/shell-global.c
@@ +171,3 @@
   /* Ensure config dir exists for later use */
 
+  global->configdir = g_build_filename (g_get_user_cache_dir (), "shell", NULL);

Not all of the data we store in congfigdir should be thought of as a "cache".   The application usage is probably closest to "g_get_user_config_dir()".
Comment 3 Milan Bouchet-Valat 2009-10-13 16:48:35 UTC
Review of attachment 145252 [details] [review]:

::: src/shell-global.c
@@ +172,2 @@
   /* Ensure config dir exists for later use */
+  global->configdir = g_build_filename (g_get_user_cache_dir (), "shell", NULL);

...and I'd name the folder "gnome-shell", we're not the only shell around.
Comment 4 Christian Persch 2009-10-13 17:10:45 UTC
+  global->configdir = g_build_filename (g_get_user_cache_dir (), "shell", NULL);
   conf_dir = g_file_new_for_path (global->configdir);
   g_file_make_directory (conf_dir, NULL, NULL);

The existing code already gets this wrong, but I'd still like to point out that using g_file_make_directory() to create the cache dir is wrong, since
-  you cannot assume g_get_user_cache_dir() already exists, and therefore you should create the dir recursively (g_file_make_directory_with_parents); BUT
- g_file_make_directory[_with_parents] makes newly created directory have the default (current) ownership and permissions of the current process; however per the XDG spec, the XDG cache dir should be created with 0700 perms.
Comment 5 Martin Meyer 2009-10-13 19:04:49 UTC
As someone just browsing through bugs, it looks to me as if this patch would put config data in ~/.cache. Is that the case? It would be preferable to put it in ~/.config.

I'm just guessing here (I haven't looked up the API docs), but did you mean to use g_get_user_config_dir() ?
Comment 6 Florian Müllner 2010-05-09 04:41:42 UTC

*** This bug has been marked as a duplicate of bug 617555 ***