Ticket #6405: cachedir.2.patch
File cachedir.2.patch, 1.5 KB (added by , 14 years ago) |
---|
-
src/org/openstreetmap/josm/data/imagery/WmsCache.java
95 95 private Map<CacheEntry, SoftReference<BufferedImage>> memoryCache = new HashMap<WmsCache.CacheEntry, SoftReference<BufferedImage>>(); 96 96 private Set<ProjectionBounds> areaToCache; 97 97 98 protected String cacheDirPath() { 99 String cPath = PROP_CACHE_PATH.get(); 100 if (!(cPath.startsWith("/") || cPath.startsWith(":/",1))) { 101 //Not an absolute path 102 cPath = Main.pref.getPreferencesDir() + cPath; 103 } 104 return cPath; 105 } 106 98 107 public WmsCache(String url, int tileSize) { 99 File globalCacheDir = new File( Main.pref.getPreferencesDir() + PROP_CACHE_PATH.get());108 File globalCacheDir = new File(cacheDirPath()); 100 109 globalCacheDir.mkdirs(); 101 110 cacheDir = new File(globalCacheDir, getCacheDirectory(url)); 102 111 cacheDir.mkdirs(); … … 109 118 OutputStream fos = null; 110 119 try { 111 120 Properties layersIndex = new Properties(); 112 File layerIndexFile = new File( Main.pref.getPreferencesDir() + PROP_CACHE_PATH.get(), LAYERS_INDEX_FILENAME);121 File layerIndexFile = new File(cacheDirPath(), LAYERS_INDEX_FILENAME); 113 122 try { 114 123 fis = new FileInputStream(layerIndexFile); 115 124 layersIndex.load(fis);