changeset 2303:a19f86d81427 trunk

[svn] Initial XDG basedir support.
author js
date Tue, 09 Jan 2007 14:51:38 -0800
parents a73097e58abb
children b0e49d195c64
files ChangeLog libaudacious/configdb_rcfile.c
diffstat 2 files changed, 27 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Tue Jan 09 09:14:22 2007 -0800
+++ b/ChangeLog	Tue Jan 09 14:51:38 2007 -0800
@@ -1,3 +1,10 @@
+2007-01-09 17:14:22 +0000  Kiyoshi Aman <kiyoshi.aman@gmail.com>
+  revision [3614]
+  Revert stupid commit by js, because that does not make us XDG basedir compliant.
+  trunk/configure.ac |    2 +-
+  1 file changed, 1 insertion(+), 1 deletion(-)
+
+
 2007-01-09 15:45:01 +0000  Jonathan Schleifer <js@h3c.de>
   revision [3612]
   Change /home/js/.audacious to /home/js/.config/audacious
--- a/libaudacious/configdb_rcfile.c	Tue Jan 09 09:14:22 2007 -0800
+++ b/libaudacious/configdb_rcfile.c	Tue Jan 09 14:51:38 2007 -0800
@@ -38,13 +38,30 @@
 bmp_cfg_db_open()
 {
     ConfigDb *db;
+    char *tmp;
 
     db = g_new(ConfigDb, 1);
-    db->filename = g_build_filename(g_get_home_dir(), BMP_RCPATH, 
-                                    "config", NULL);
+
+    if ((tmp = getenv("XDG_CONFIG_HOME")) == NULL)
+        db->filename = g_build_filename(g_get_home_dir(), ".config",
+                                        "audacious", "config", NULL);
+    else
+        db->filename = g_build_filename(tmp, "audacious", "config", NULL);
+
     db->file = bmp_rcfile_open(db->filename);
-    if (!db->file)
+
+    if (!db->file) {
+        tmp = g_build_filename(g_get_home_dir(), BMP_RCPATH, "config", NULL);
+        if (db->file = bmp_rcfile_open(tmp)) {
+            g_free(db->filename);
+            db->filename = tmp;
+        }
+    }
+
+    if (!db->file) {
+        g_free(tmp);
         db->file = bmp_rcfile_new();
+    }
 
     db->dirty = FALSE;