Author: fdesbois Date: 2009-12-16 14:22:57 +0100 (Wed, 16 Dec 2009) New Revision: 1704 Modified: trunk/src/main/java/org/nuiton/util/ApplicationConfig.java Log: - Add methods to get and set directly all options. - Change userHome configuration path to : $HOME/.local/[filename] - Improve call to getResource method from class to search in root path directory (and not ApplicationConfig package) Modified: trunk/src/main/java/org/nuiton/util/ApplicationConfig.java =================================================================== --- trunk/src/main/java/org/nuiton/util/ApplicationConfig.java 2009-12-16 10:26:59 UTC (rev 1703) +++ trunk/src/main/java/org/nuiton/util/ApplicationConfig.java 2009-12-16 13:22:57 UTC (rev 1704) @@ -274,7 +274,10 @@ /** file /etc/[filename] */ String systemPath = File.separator + "etc" + File.separator; /** file $user.home/.[filename] */ - String userPath = getUserHome() + File.separator + "."; + //String userPath = getUserHome() + File.separator + "."; + /** file $user.home/.local/[filename] */ + String userPath = getUserHome() + File.separator + ".local" + + /*File.separator + "share" + File.separator + "applications" + */File.separator; /** vrai si on est en train de parser les options de la ligne de commande */ protected boolean inParseOptionPhase = false; protected Properties defaults = new Properties(); @@ -745,6 +748,23 @@ } /** + * Get all options from configuration. + * @return Properties which contains all options + */ + public Properties getOptions() { + return this.options; + } + + /** + * Set manually options when you don't want to use parse method to check + * properties file configured by setConfigFileName. + * @param options Properties which contains all options to set + */ + public void setOptions(Properties options) { + this.options = options; + } + + /** * Get all set method on this object or super object * * @return map with method name without set and in lower case as key, and @@ -930,7 +950,7 @@ String filename = getConfigFileName(); URL inClasspath = ClassLoader.getSystemClassLoader().getResource(filename); if (inClasspath == null) { - inClasspath = ApplicationConfig.class.getResource(filename); + inClasspath = ApplicationConfig.class.getResource("/" + filename); } if (inClasspath != null) { log.info("Chargement du fichier de config: " + inClasspath);