]> Dogcows Code - chaz/openbox/commitdiff
add support for XDG_CACHE_HOME to the obt paths
authorDana Jansens <danakj@orodu.net>
Sun, 20 Jan 2008 15:29:09 +0000 (10:29 -0500)
committerDana Jansens <danakj@orodu.net>
Thu, 31 Jan 2008 17:25:30 +0000 (12:25 -0500)
obt/paths.c
obt/paths.h

index c43d48b87e4ae33a9998fd592c222b0c03b65810..6100499893e306a3dce92cd1fd041f49c20c85c2 100644 (file)
@@ -34,6 +34,7 @@ struct _ObtPaths
     gint   ref;
     gchar  *config_home;
     gchar  *data_home;
+    gchar  *cache_home;
     GSList *config_dirs;
     GSList *data_dirs;
 };
@@ -95,6 +96,12 @@ ObtPaths* obt_paths_new(void)
         p->data_home = g_build_filename(g_get_home_dir(), ".local",
                                         "share", NULL);
 
+    path = g_getenv("XDG_CACHE_HOME");
+    if (path && path[0] != '\0') /* not unset or empty */
+        p->cache_home = g_build_filename(path, NULL);
+    else
+        p->cache_home = g_build_filename(g_get_home_dir(), ".cache", NULL);
+
     path = g_getenv("XDG_CONFIG_DIRS");
     if (path && path[0] != '\0') /* not unset or empty */
         p->config_dirs = split_paths(path);
@@ -154,6 +161,7 @@ void obt_paths_unref(ObtPaths *p)
         g_slist_free(p->data_dirs);
         g_free(p->config_home);
         g_free(p->data_home);
+        g_free(p->cache_home);
 
         obt_free0(p, ObtPaths, 1);
     }
@@ -223,6 +231,11 @@ const gchar* obt_paths_data_home(ObtPaths *p)
     return p->data_home;
 }
 
+const gchar* obt_paths_cache_home(ObtPaths *p)
+{
+    return p->cache_home;
+}
+
 GSList* obt_paths_config_dirs(ObtPaths *p)
 {
     return p->config_dirs;
index b9a095957f219bb33871d2973ac79ea74eaf6b52..a6e32ae1bc0737296653eca217763fe58d8fabb5 100644 (file)
@@ -31,6 +31,7 @@ void obt_paths_unref(ObtPaths *p);
 
 const gchar* obt_paths_config_home(ObtPaths *p);
 const gchar* obt_paths_data_home(ObtPaths *p);
+const gchar* obt_paths_cache_home(ObtPaths *p);
 GSList* obt_paths_config_dirs(ObtPaths *p);
 GSList* obt_paths_data_dirs(ObtPaths *p);
 
This page took 0.025971 seconds and 4 git commands to generate.