make cachedir variable (use in extensions)

This commit is contained in:
sirjonasxx 2021-08-29 22:48:21 +02:00
parent 7ac33ef408
commit 1f7d9270c2

View File

@ -17,8 +17,9 @@ import java.util.List;
public class Cacher { public class Cacher {
private static final String DEFAULT_CACHE_FILENAME = "cache.json"; private static final String DEFAULT_CACHE_FILENAME = "cache.json";
private static String cacheDir;
public static String getCacheDir() { static {
File GEarthDir = null; File GEarthDir = null;
try { try {
GEarthDir = new File(Main.class.getProtectionDomain().getCodeSource().getLocation().toURI()).getParentFile(); GEarthDir = new File(Main.class.getProtectionDomain().getCodeSource().getLocation().toURI()).getParentFile();
@ -26,15 +27,21 @@ public class Cacher {
GEarthDir = GEarthDir.getParentFile(); GEarthDir = GEarthDir.getParentFile();
} }
} catch (URISyntaxException e) { } catch (URISyntaxException e) { }
// e.printStackTrace();
}
return GEarthDir cacheDir = GEarthDir
+ File.separator + File.separator
+ "Cache"; + "Cache";
} }
public static void setCacheDir(String s) {
cacheDir = s;
}
public static String getCacheDir() {
return cacheDir;
}
public static boolean cacheFileExists(String cache_filename) { public static boolean cacheFileExists(String cache_filename) {