Changeset 4813 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2012-01-17T17:16:09+01:00 (13 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/data
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/Preferences.java
r4811 r4813 82 82 */ 83 83 private File preferencesDirFile = null; 84 /** 85 * Internal storage for the cache directory. 86 */ 87 private File cacheDirFile = null; 84 88 85 89 /** … … 271 275 272 276 public File getCacheDirectory() { 273 File cache = new File(getPreferencesDirFile(), "cache"); 274 if (!cache.exists() && !cache.mkdirs()) { 275 System.err.println(tr("Warning: Failed to create missing cache directory: {0}", cache.getAbsoluteFile())); 277 if (cacheDirFile != null) 278 return cacheDirFile; 279 String path = System.getProperty("josm.cache"); 280 if (path != null) { 281 cacheDirFile = new File(path).getAbsoluteFile(); 282 } else { 283 path = Main.pref.get("cache.folder", null); 284 if (path != null) { 285 cacheDirFile = new File(path); 286 } else { 287 cacheDirFile = new File(getPreferencesDirFile(), "cache"); 288 } 289 } 290 if (!cacheDirFile.exists() && !cacheDirFile.mkdirs()) { 291 System.err.println(tr("Warning: Failed to create missing cache directory: {0}", cacheDirFile.getAbsoluteFile())); 276 292 JOptionPane.showMessageDialog( 277 293 Main.parent, 278 tr("<html>Failed to create missing cache directory: {0}</html>", cache.getAbsoluteFile()),294 tr("<html>Failed to create missing cache directory: {0}</html>", cacheDirFile.getAbsoluteFile()), 279 295 tr("Error"), 280 296 JOptionPane.ERROR_MESSAGE 281 297 ); 282 298 } 283 return cache ;299 return cacheDirFile; 284 300 } 285 301 -
trunk/src/org/openstreetmap/josm/data/imagery/WmsCache.java
r4745 r4813 53 53 //TODO Do loading from partial cache and downloading at the same time, don't wait for partical cache to load 54 54 55 private static final StringProperty PROP_CACHE_PATH = new StringProperty("imagery.wms-cache.path", "wms-cache");55 private static final StringProperty PROP_CACHE_PATH = new StringProperty("imagery.wms-cache.path", new File(Main.pref.getCacheDirectory(), "wms").getPath()); 56 56 private static final String INDEX_FILENAME = "index.xml"; 57 57 private static final String LAYERS_INDEX_FILENAME = "layers.properties"; … … 100 100 if (!(cPath.startsWith("/") || cPath.startsWith(":/",1))) { 101 101 //Not an absolute path 102 cPath = Main.pref.get PreferencesDir() + cPath;102 cPath = Main.pref.getCacheDirectory() + cPath; 103 103 } 104 104 return cPath;
Note:
See TracChangeset
for help on using the changeset viewer.