[PATCH] modules-Config-Dir introduced
Wald Commits
scm-commit at wald.intevation.org
Tue Sep 4 16:44:36 CEST 2018
# HG changeset patch
# User gernotbelger
# Date 1536072271 -7200
# Node ID 2b631f788ce1732db9986b8dc7e82c8229f6009b
# Parent 06257387b98f3d600c485446b7651ec6df6a6f82
modules-Config-Dir introduced
diff -r 06257387b98f -r 2b631f788ce1 artifacts-common/src/main/java/org/dive4elements/artifacts/common/utils/Config.java
--- a/artifacts-common/src/main/java/org/dive4elements/artifacts/common/utils/Config.java Thu Jul 26 14:36:32 2018 +0200
+++ b/artifacts-common/src/main/java/org/dive4elements/artifacts/common/utils/Config.java Tue Sep 04 16:44:31 2018 +0200
@@ -76,8 +76,7 @@
return config;
}
- public static Properties loadProperties(final String CONFIG_FILE_LOCAL) throws IOException {
- final File configDir = getConfigDirectory();
+ public static Properties loadProperties(final String CONFIG_FILE_LOCAL, final File configDir) throws IOException {
final File configFile = new File(configDir, CONFIG_FILE_LOCAL);
InputStream reader = null;
@@ -119,6 +118,21 @@
}
/**
+ * returns the path to modules-config, which is a subfolder of config
+ */
+ public static File getModulesConfigDirectory() {
+
+ final File configDir = getConfigDirectory();
+ final File modulesCfgFile = new File(configDir, "modules");
+
+ if (!modulesCfgFile.isDirectory()) {
+ logger.warn("'" + modulesCfgFile + "' is not a directory.");
+ return CONFIG_DIR_DEFAULT; // or null?
+ }
+ return modulesCfgFile;
+ }
+
+ /**
* Replaces the CONFIG_DIR_PLACEHOLDER alias with the real path
* of the configuration directory.
*
More information about the Dive4Elements-commits
mailing list