Mercurial > dive4elements > framework
changeset 560:2b631f788ce1
modules-Config-Dir introduced
author | gernotbelger |
---|---|
date | Tue, 04 Sep 2018 16:44:31 +0200 |
parents | 06257387b98f |
children | 1c2ce0501305 |
files | artifacts-common/src/main/java/org/dive4elements/artifacts/common/utils/Config.java |
diffstat | 1 files changed, 16 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- 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. *