summaryrefslogtreecommitdiff
path: root/gtk/gtkrecentmanager.c
diff options
context:
space:
mode:
authorEmmanuele Bassi <ebassi@gnome.org>2012-07-04 11:41:50 +0100
committerMatthias Clasen <mclasen@redhat.com>2012-07-12 08:42:33 -0400
commit3d7a2d788312c10c1e953cf6af794a1cc3c71e18 (patch)
treec76e717d2100134e1960a699f315560a8bb41d4f /gtk/gtkrecentmanager.c
parent0ddb50235fd9c3ce7c37c945bea1d59c45d3dd59 (diff)
downloadgtk+-3d7a2d788312c10c1e953cf6af794a1cc3c71e18.tar.gz
Ensure that XDG_DATA_HOME is created before using it
The recently-used.xbel storage for recently used files is located inside the $XDG_DATA_HOME directory; there's no actual guarantee that the directory has been created already, even though it's very highly probable on any modern distribution. We should create it, along with its intermediate parents, before constructing the file monitor that we use to get change notifications. https://bugzilla.gnome.org/show_bug.cgi?id=671817 https://bugzilla.gnome.org/show_bug.cgi?id=667808
Diffstat (limited to 'gtk/gtkrecentmanager.c')
-rw-r--r--gtk/gtkrecentmanager.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/gtk/gtkrecentmanager.c b/gtk/gtkrecentmanager.c
index 9d20011cce..d6b23e7c2e 100644
--- a/gtk/gtkrecentmanager.c
+++ b/gtk/gtkrecentmanager.c
@@ -539,6 +539,18 @@ gtk_recent_manager_monitor_changed (GFileMonitor *monitor,
static gchar *
get_default_filename (void)
{
+ if (g_mkdir_with_parents (g_get_user_data_dir (), 0755) == -1)
+ {
+ int saved_errno = errno;
+
+ g_critical ("Unable to create user data directory '%s' for storing "
+ "the recently used files list: %s",
+ g_get_user_data_dir (),
+ g_strerror (saved_errno));
+
+ return NULL;
+ }
+
return g_build_filename (g_get_user_data_dir (),
GTK_RECENTLY_USED_FILE,
NULL);