Browse Source

Use XDG_CONFIG_HOME for storing the config if ~/.DMDirc/ does not exist.

Fixes issue 3097

Change-Id: I3e85e23908421bc6631718dfd74027acb61a3249
Reviewed-on: http://gerrit.dmdirc.com/92
Reviewed-by: Gregory Holmes <greboid@dmdirc.com>
Tested-by: Gregory Holmes <greboid@dmdirc.com>
tags/0.6.3b1
Shane Mc Cormack 14 years ago
parent
commit
7f0a0f7d38
2 changed files with 16 additions and 1 deletions
  1. 8
    1
      launcher/unix/DMDirc.sh
  2. 8
    0
      src/com/dmdirc/Main.java

+ 8
- 1
launcher/unix/DMDirc.sh View File

@@ -172,9 +172,16 @@ fi;
172 172
 
173 173
 # Check for some CLI params
174 174
 if [ "${ISOSX}" = "1" ]; then
175
-	profiledir="${HOME}/Library/Preferences/DMDirc"
175
+	profiledir="${HOME}/Library/Preferences/DMDirc/"
176 176
 else
177 177
 	profiledir="${HOME}/.DMDirc/"
178
+	if [ ! -d "${profiledir}" ]; then
179
+		profiledir="${XDG_CONFIG_HOME}"
180
+		if [ "${profiledir}" = "" ]; then
181
+			profiledir="${HOME}/.config"
182
+		fi;
183
+		profiledir="${profiledir}/DMDirc/"
184
+	fi;
178 185
 fi;
179 186
 
180 187
 USEPROFILE=1;

+ 8
- 0
src/com/dmdirc/Main.java View File

@@ -332,6 +332,14 @@ public final class Main {
332 332
                 }
333 333
             } else {
334 334
                 configdir = System.getProperty("user.home") + fs + ".DMDirc" + fs;
335
+                final File testFile = new File(configdir);
336
+                if (!testFile.exists()) {
337
+                    final String configHome = System.getenv("XDG_CONFIG_HOME");
338
+                    configdir = configHome.isEmpty() ?
339
+                        System.getProperty("user.home") + fs + ".config" + fs :
340
+                        configHome;
341
+                    configdir += fs + "DMDirc" + fs;
342
+                }
335 343
             }
336 344
         }
337 345
 

Loading…
Cancel
Save