From 0e44a91c3711cb808dd53fc1a6efd9cf7066183c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=CC=88rg=20Prante?= Date: Thu, 21 Jan 2021 16:04:11 +0100 Subject: [PATCH] implement XDG config home --- .../java/org/xbib/content/config/ConfigLoader.java | 10 +++++++--- gradle.properties | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/content-config/src/main/java/org/xbib/content/config/ConfigLoader.java b/content-config/src/main/java/org/xbib/content/config/ConfigLoader.java index 68ca979..de089f2 100644 --- a/content-config/src/main/java/org/xbib/content/config/ConfigLoader.java +++ b/content-config/src/main/java/org/xbib/content/config/ConfigLoader.java @@ -125,13 +125,17 @@ public class ConfigLoader { } private static List createListOfLocations(String applicationName, String fileNameWithoutSuffix) { + String xdgConfigHome = System.getenv("XDG_CONFIG_HOME"); + if (xdgConfigHome == null) { + xdgConfigHome = System.getProperty("user.home") + "/.config"; + } return List.of( applicationName + '-' + fileNameWithoutSuffix + YML, applicationName + '-' + fileNameWithoutSuffix + YAML, applicationName + '-' + fileNameWithoutSuffix + JSON, - System.getProperty("user.home") + "/." + applicationName + '/' + fileNameWithoutSuffix + YML, - System.getProperty("user.home") + "/." + applicationName + '/' + fileNameWithoutSuffix + YAML, - System.getProperty("user.home") + "/." + applicationName + '/' + fileNameWithoutSuffix + JSON, + xdgConfigHome + '/' + applicationName + '/' + fileNameWithoutSuffix + YML, + xdgConfigHome + '/' + applicationName + '/' + fileNameWithoutSuffix + YAML, + xdgConfigHome + '/' + applicationName + '/' + fileNameWithoutSuffix + JSON, "/etc/" + applicationName + '/' + fileNameWithoutSuffix + YML, "/etc/" + applicationName + '/' + fileNameWithoutSuffix + YAML, "/etc/" + applicationName + '/' + fileNameWithoutSuffix + JSON); diff --git a/gradle.properties b/gradle.properties index a411453..f7b7fd2 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,6 +1,6 @@ group = org.xbib name = content -version = 2.6.1 +version = 2.6.2 gradle.wrapper.version = 6.6.1 xbib.net.version = 2.1.0