implement XDG config home

This commit is contained in:
Jörg Prante 2021-01-21 16:04:11 +01:00
parent 040faea906
commit 0e44a91c37
2 changed files with 8 additions and 4 deletions

View file

@ -125,13 +125,17 @@ public class ConfigLoader {
}
private static List<String> 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);

View file

@ -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