From 1f7d9270c291fa110c13987b5c204662cb14cc1e Mon Sep 17 00:00:00 2001 From: sirjonasxx <36828922+sirjonasxx@users.noreply.github.com> Date: Sun, 29 Aug 2021 22:48:21 +0200 Subject: [PATCH] make cachedir variable (use in extensions) --- G-Earth/src/main/java/gearth/misc/Cacher.java | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/G-Earth/src/main/java/gearth/misc/Cacher.java b/G-Earth/src/main/java/gearth/misc/Cacher.java index ace14c9..dd7b6a1 100644 --- a/G-Earth/src/main/java/gearth/misc/Cacher.java +++ b/G-Earth/src/main/java/gearth/misc/Cacher.java @@ -17,8 +17,9 @@ import java.util.List; public class Cacher { private static final String DEFAULT_CACHE_FILENAME = "cache.json"; + private static String cacheDir; - public static String getCacheDir() { + static { File GEarthDir = null; try { GEarthDir = new File(Main.class.getProtectionDomain().getCodeSource().getLocation().toURI()).getParentFile(); @@ -26,15 +27,21 @@ public class Cacher { GEarthDir = GEarthDir.getParentFile(); } - } catch (URISyntaxException e) { -// e.printStackTrace(); - } + } catch (URISyntaxException e) { } - return GEarthDir + cacheDir = GEarthDir + File.separator + "Cache"; } + public static void setCacheDir(String s) { + cacheDir = s; + } + + public static String getCacheDir() { + return cacheDir; + } + public static boolean cacheFileExists(String cache_filename) {