Skip to content

Commit

Permalink
Fix Cache Path Detection (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
Caedis authored Jan 13, 2025
1 parent 3780e53 commit bb33936
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/main/java/GTNHNightlyUpdater/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public static void main(String[] args) {
CommandLine.usage(options, System.out);
System.exit(2);
} catch (Exception e) {
log.fatal(e);
log.fatal("Fataled", e);
System.exit(1);
}
}
Expand All @@ -65,11 +65,13 @@ private static Path getCacheDir() {
if (osName.contains("win")) {
cacheDir = Path.of(System.getenv("LOCALAPPDATA"));
} else if (osName.contains("mac")) {
cacheDir = Path.of(System.getProperty("user.home"), "Library", "Caches");
cacheDir = Path.of(System.getenv("HOME"), "Library", "Caches");
} else {
cacheDir = Path.of(System.getenv("XDG_CACHE_HOME"));
if (Files.notExists(cacheDir)) {
cacheDir = Path.of(System.getProperty("user.home"), ".cache");
String cache = System.getenv("XDG_CACHE_HOME");
if (cache != null){
cacheDir = Path.of(cache);
} else {
cacheDir = Path.of(System.getenv("HOME"), ".cache");
}
}

Expand Down

0 comments on commit bb33936

Please sign in to comment.