GNOME Bugzilla – Bug 598102
Don't harcode cache configuration in ~/.gnome2/shell
Last modified: 2010-05-09 04:41:42 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.
Created attachment 145252 [details] [review] Use XDG compliant directory for storing config
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()".
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.
+ 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.
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() ?
*** This bug has been marked as a duplicate of bug 617555 ***