1 package tim.prune.function.srtm;
5 import tim.prune.config.Config;
6 import tim.prune.I18nManager;
8 public class SrtmDiskCache {
10 private static boolean _cacheIsUsable = false;
11 private static File _cacheDir = null;
13 public static boolean ensureCacheIsUsable()
20 // Check the cache is ok
21 String diskCachePath = Config.getConfigString(Config.KEY_DISK_CACHE);
22 if (diskCachePath == null)
26 File srtmDir = new File(diskCachePath, "srtm");
27 if (!srtmDir.exists() && !srtmDir.mkdir()) {
28 // can't create the srtm directory
31 _cacheIsUsable = true;
36 public static File getCacheDir(String inSourceName)
38 if (_cacheDir == null)
40 ensureCacheIsUsable();
42 File cacheDir = new File(_cacheDir, inSourceName);
43 if (!cacheDir.exists() && !cacheDir.mkdir()) {
44 // can't create the srtm directory