Skip to content

Commit fb59017

Browse files
authored
Merge pull request #53 from cjmang/mac_cache
Hopefully final pass at datapackage cache
2 parents 5848ae8 + 9971926 commit fb59017

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

src/main/java/dev/koifysh/archipelago/Client.java

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,21 +40,25 @@ public abstract class Client {
4040
static
4141
{
4242
String appData = System.getenv("LOCALAPPDATA");
43-
String winHome = System.getenv("USERPROFILE");
4443
String userHome = System.getProperty("user.home");
44+
String xdg = System.getenv("XDG_CACHE_HOME");
4545

4646
if(OS.startsWith("windows"))
4747
{
48-
if(appData == null || appData.isEmpty()) {
49-
cachePath = Paths.get(winHome, "appdata", "local", "Archipelago", "Cache");
50-
} else {
51-
cachePath = Paths.get(appData, "Archipelago", "Cache");
52-
}
48+
cachePath = Paths.get(appData, "Archipelago", "Cache");
5349
}
54-
else
50+
else if(OS.startsWith("Mac") || OS.startsWith("Darwin"))
51+
{
52+
cachePath = Paths.get(userHome, "Library", "Caches", "Archipelago");
53+
}
54+
else if(xdg == null || xdg.isEmpty() )
5555
{
5656
cachePath = Paths.get(userHome, ".cache", "Archipelago");
5757
}
58+
else
59+
{
60+
cachePath = Paths.get(xdg, "Archipelago");
61+
}
5862
datapackageCachePath = cachePath.resolve("datapackage");
5963

6064
}

0 commit comments

Comments
 (0)