Skip to content

Commit d2b806b

Browse files
committed
find installation dir for flatpack installation of official launcher
1 parent 5a5e75f commit d2b806b

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

src/main/java/org/quiltmc/installer/OsPaths.java

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616

1717
package org.quiltmc.installer;
1818

19+
import java.io.IOException;
20+
import java.nio.file.Files;
1921
import java.nio.file.Path;
2022
import java.nio.file.Paths;
2123
import java.util.Locale;
@@ -50,10 +52,21 @@ public static Path getDefaultInstallationDir() {
5052
return homeDir.resolve(MAC_LIBRARY)
5153
.resolve(MAC_APPLICATION_SUPPORT)
5254
.resolve("minecraft");
53-
}
55+
} else {
56+
// Assume Linux-like directory as a fallback
57+
Path dir = homeDir.resolve(DOT_MINECRAFT);
5458

55-
// Assume Linux-like directory as a fallback
56-
return homeDir.resolve(DOT_MINECRAFT);
59+
if (!Files.exists(dir)) {
60+
// try flatpack location
61+
Path fpdir = homeDir.resolve(".var").resolve("app").resolve("com.mojang.Minecraft").resolve(DOT_MINECRAFT);
62+
63+
if (Files.isDirectory(fpdir)) {
64+
dir = fpdir;
65+
}
66+
}
67+
68+
return dir;
69+
}
5770
}
5871

5972
public static Path getUserDataDir() {

0 commit comments

Comments
 (0)