mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-06-12 16:31:55 +00:00
Add support for XDG base directory specification
This commit is contained in:
committed by
Jindra Petřík
parent
2336515b17
commit
89d7a47453
@@ -1061,9 +1061,24 @@ public final class Configuration {
|
||||
String path = "Library/Application Support/" + applicationId + "/";
|
||||
directory = new File(userHome, path);
|
||||
} else {
|
||||
// ${userHome}/.${applicationId}/
|
||||
String path = "." + applicationId + "/";
|
||||
directory = new File(userHome, path);
|
||||
File xdgConfigHome = null;
|
||||
try {
|
||||
String xdgConfigHomeEV = System.getenv("XDG_CONFIG_HOME");
|
||||
if ((xdgConfigHomeEV != null) && (xdgConfigHomeEV.length() > 0)) {
|
||||
xdgConfigHome = new File(xdgConfigHomeEV);
|
||||
}
|
||||
} catch (SecurityException ignore) {
|
||||
//ignored
|
||||
}
|
||||
if ((xdgConfigHome != null) && xdgConfigHome.isDirectory()) {
|
||||
// ${xdgConfigHome}/${applicationId}
|
||||
String path = applicationId + "/";
|
||||
directory = new File(xdgConfigHome, path);
|
||||
} else {
|
||||
// ${userHome}/.config/${applicationId}
|
||||
String path = ".config/" + applicationId + "/";
|
||||
directory = new File(userHome, path);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
//no home, then use application directory
|
||||
|
||||
Reference in New Issue
Block a user