diff options
author | Noah Vogt | 2021-12-20 17:38:50 +0100 |
---|---|---|
committer | Noah Vogt | 2021-12-20 17:38:50 +0100 |
commit | e2d82669d4718c4335d7332dc2d07c97ee788c7a (patch) | |
tree | 4fdefa62230c166c291e823fdb2ff14e384a84fd /xdg-basedir-compliant-userPrefs.patch | |
parent | 4dccf7039f1b90acf69d1b967f0afd24ac5f8bb9 (diff) | |
download | aur-e2d82669d4718c4335d7332dc2d07c97ee788c7a.tar.gz |
uppkg -> 17.0.1.u12-2
Diffstat (limited to 'xdg-basedir-compliant-userPrefs.patch')
-rw-r--r-- | xdg-basedir-compliant-userPrefs.patch | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/xdg-basedir-compliant-userPrefs.patch b/xdg-basedir-compliant-userPrefs.patch new file mode 100644 index 000000000000..78601d6442b4 --- /dev/null +++ b/xdg-basedir-compliant-userPrefs.patch @@ -0,0 +1,38 @@ +# TODO: consider changing system-wide preferences +# consider removing dot in front of 'lock' files (both system and user) +--- a/src/java.prefs/unix/classes/java/util/prefs/FileSystemPreferences.java ++++ b/src/java.prefs/unix/classes/java/util/prefs/FileSystemPreferences.java +@@ -114,9 +114,30 @@ + private static void setupUserRoot() { + AccessController.doPrivileged(new PrivilegedAction<Void>() { + public Void run() { +- userRootDir = +- new File(System.getProperty("java.util.prefs.userRoot", +- System.getProperty("user.home")), ".java/.userPrefs"); ++ /* On Linux systems, put the userPrefs dir into ++ * ${XDG_CONFIG_HOME:-$HOME/.config}/java/userPrefs in order to ++ * follow the XDG Base Directory Specification. ++ */ ++ if (System.getProperty("os.name").equals("Linux")) { ++ /* assume findable homedir, which the jvm already does */ ++ String xdgDefaultConfigHome = System.getenv("HOME") + ++ "/.config"; ++ String xdgConfigHomeEnvVar = "XDG_CONFIG_HOME"; ++ String xdgConfigDir; ++ ++ String xdgSetConfigDir = System.getenv(xdgConfigHomeEnvVar); ++ ++ if (xdgSetConfigDir == null) ++ xdgConfigDir = xdgDefaultConfigHome; ++ else ++ xdgConfigDir = xdgSetConfigDir; ++ ++ userRootDir = new File(xdgConfigDir, "java/userPrefs"); ++ } else { ++ userRootDir = ++ new File(System.getProperty("java.util.prefs.userRoot", ++ System.getProperty("user.home")), ".java/.userPrefs"); ++ } + // Attempt to create root dir if it does not yet exist. + if (!userRootDir.exists()) { + if (userRootDir.mkdirs()) { |