Author: fdesbois Date: 2009-12-17 17:36:57 +0100 (Thu, 17 Dec 2009) New Revision: 1719 Modified: trunk/src/main/java/org/nuiton/util/ApplicationConfig.java Log: Evol #161 : Change default folder for user configuration. Move previous file config. Modified: trunk/src/main/java/org/nuiton/util/ApplicationConfig.java =================================================================== --- trunk/src/main/java/org/nuiton/util/ApplicationConfig.java 2009-12-17 16:35:54 UTC (rev 1718) +++ trunk/src/main/java/org/nuiton/util/ApplicationConfig.java 2009-12-17 16:36:57 UTC (rev 1719) @@ -274,10 +274,12 @@ /** file /etc/[filename] */ String systemPath = File.separator + "etc" + File.separator; /** file $user.home/.[filename] */ - //String userPath = getUserHome() + File.separator + "."; + @Deprecated + String userPath1 = getUserHome() + File.separator + "."; /** file $user.home/.local/[filename] */ - String userPath = getUserHome() + File.separator + ".local" + - /*File.separator + "share" + File.separator + "applications" + */File.separator; + String userPath2 = getUserHome() + File.separator + ".config" + File.separator; + //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(); @@ -468,7 +470,7 @@ * @param excludeKeys optional list of keys to exclude from */ public void saveForUser(String... excludeKeys) { - File file = new File(userPath + getConfigFileName()); + File file = new File(userPath2 + getConfigFileName()); try { save(file, false, excludeKeys); } catch (IOException eee) { @@ -965,11 +967,16 @@ etcfile.load(etcConfig.toURI().toURL().openStream()); } - File homeConfig = new File(userPath + filename); - if (homeConfig.exists()) { - log.info("Chargement du fichier de config: " + homeConfig); - homefile.load(homeConfig.toURI().toURL().openStream()); + File homeConfig1 = new File(userPath1 + filename); + File homeConfig2 = new File(userPath2 + filename); + if (!homeConfig2.exists() && homeConfig1.exists()) { + log.info("Déplacement de l'ancien fichier de config: " + homeConfig1); + homeConfig1.renameTo(homeConfig2); } + if (homeConfig2.exists()) { + log.info("Chargement du fichier de config: " + homeConfig2); + homefile.load(homeConfig2.toURI().toURL().openStream()); + } // file $CURDIR/filename File config = new File(filename);