Changeset 20 in josm for src/org/openstreetmap/josm/data
- Timestamp:
- 2005-10-13T08:27:12+02:00 (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/org/openstreetmap/josm/data/Preferences.java
r18 r20 6 6 import java.io.FileReader; 7 7 import java.io.FileWriter; 8 import java.io.IOException; 8 9 import java.util.Collection; 9 10 import java.util.LinkedList; … … 79 80 * Return the location of the preferences file 80 81 */ 81 public static String getPreferences File() {82 return System.getProperty("user.home")+"/.josm -preferences";82 public static String getPreferencesDir() { 83 return System.getProperty("user.home")+"/.josm/"; 83 84 } 84 85 … … 91 92 super(message, cause); 92 93 } 94 public PreferencesException(String message) { 95 super(message); 96 } 93 97 } 94 98 /** … … 97 101 */ 98 102 public void load() throws PreferencesException { 99 File file = new File( System.getProperty("user.home")+"/.josm-preferences");103 File file = new File(getPreferencesDir()+"/preferences"); 100 104 Element root; 101 105 try { … … 159 163 160 164 try { 161 final FileWriter file = new FileWriter(getPreferencesFile()); 165 File prefDir = new File(getPreferencesDir()); 166 if (prefDir.exists() && !prefDir.isDirectory()) 167 throw new PreferencesException("Preferences directory "+getPreferencesDir()+" is not a directory."); 168 if (!prefDir.exists()) 169 prefDir.mkdirs(); 170 171 FileWriter file = new FileWriter(getPreferencesDir()+"/preferences"); 162 172 new XMLOutputter(Format.getPrettyFormat()).output(root, file); 163 173 file.close(); 164 } catch ( Exception e) {174 } catch (IOException e) { 165 175 throw new PreferencesException("Could not write preferences", e); 166 176 }
Note:
See TracChangeset
for help on using the changeset viewer.