Author: tchemit Date: 2010-04-14 19:15:09 +0200 (Wed, 14 Apr 2010) New Revision: 1828 Log: improve ApplicationConfig Modified: trunk/src/main/java/org/nuiton/util/ApplicationConfig.java Modified: trunk/src/main/java/org/nuiton/util/ApplicationConfig.java =================================================================== --- trunk/src/main/java/org/nuiton/util/ApplicationConfig.java 2010-04-14 16:27:47 UTC (rev 1827) +++ trunk/src/main/java/org/nuiton/util/ApplicationConfig.java 2010-04-14 17:15:09 UTC (rev 1828) @@ -619,7 +619,7 @@ * @param excludeKeys optional list of keys to exclude from */ public void saveForSystem(String... excludeKeys) { - File file = new File(new File(getConfigPath()), getConfigFileName()); + File file = getSystemConfigFile(); if (log.isDebugEnabled()) { log.debug("will save system configuration in " + file); } @@ -640,7 +640,7 @@ * @param excludeKeys optional list of keys to exclude from */ public void saveForUser(String... excludeKeys) { - File file = new File(new File(getUserPath()), getConfigFileName()); + File file = getUserConfigFile(); if (log.isDebugEnabled()) { log.debug("will save user configuration in " + file); } @@ -655,6 +655,25 @@ } /** + * Obtain the system config file location. + * + * @return the system config file location + */ + public File getSystemConfigFile() { + File file = new File(getConfigPath(), getConfigFileName()); + return file; + } + + /** + * Obtain the user config file location. + * + * @return the user config file location + */ + public File getUserConfigFile() { + return new File(getUserPath(), getConfigFileName()); + } + + /** * Return list of unparsed command line argument * * @return list of unparsed arguments @@ -1471,7 +1490,8 @@ } // system directory - File etcConfig = new File(getConfigPath(), filename); + File etcConfig = getSystemConfigFile(); +// File etcConfig = new File(getConfigPath(), filename); if (etcConfig.exists()) { if (log.isInfoEnabled()) { log.info("Loading configuration file (etc) : " + etcConfig); @@ -1491,7 +1511,8 @@ } // user home directory - File homeConfig = new File(getUserPath(), filename); + File homeConfig = getUserConfigFile(); +// File homeConfig = new File(getUserPath(), filename); if (log.isDebugEnabled()) { log.debug("User configuration file : " + homeConfig); }