Ticket #6405: cachedir.patch

File cachedir.patch, 935 bytes (added by bilbo, 15 years ago)

patch to allow absolute cache path

  • src/org/openstreetmap/josm/data/imagery/WmsCache.java

     
    9696    private Set<ProjectionBounds> areaToCache;
    9797
    9898    public WmsCache(String url, int tileSize) {
    99         File globalCacheDir = new File(Main.pref.getPreferencesDir() + PROP_CACHE_PATH.get());
     99        String cacheDirPath = PROP_CACHE_PATH.get();
     100        if (!(cacheDirPath.startsWith("/") || cacheDirPath.startsWith(":/",1))) {
     101            //Not an absolute path
     102            cacheDirPath = Main.pref.getPreferencesDir() + cacheDirPath;
     103        }
     104        File globalCacheDir = new File(cacheDirPath);
    100105        globalCacheDir.mkdirs();
    101106        cacheDir = new File(globalCacheDir, getCacheDirectory(url));
    102107        cacheDir.mkdirs();