Changeset 4108 in josm


Ignore:
Timestamp:
2011-06-01T20:27:55+02:00 (14 years ago)
Author:
stoecker
Message:

fix #6405 - patch by bilbo - wms cache accepting absolute filenames

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/imagery/WmsCache.java

    r4082 r4108  
    9696    private Set<ProjectionBounds> areaToCache;
    9797
     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
    98107    public WmsCache(String url, int tileSize) {
    99         File globalCacheDir = new File(Main.pref.getPreferencesDir() + PROP_CACHE_PATH.get());
     108        File globalCacheDir = new File(cacheDirPath());
    100109        globalCacheDir.mkdirs();
    101110        cacheDir = new File(globalCacheDir, getCacheDirectory(url));
     
    110119        try {
    111120            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);
    113122            try {
    114123                fis = new FileInputStream(layerIndexFile);
Note: See TracChangeset for help on using the changeset viewer.