Look for Minecraft directory on Linux

This commit is contained in:
Andrew Punch 2023-12-25 22:02:02 +11:00
parent 2140894905
commit d5103f6f1a

View file

@ -257,16 +257,17 @@ namespace NBTExplorer.Windows
return;
try {
foreach (string path in new[] {
foreach (string basepath in new[] {
Environment.ExpandEnvironmentVariables("%APPDATA%"),
Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
Environment.GetFolderPath(Environment.SpecialFolder.UserProfile) } // Tries Linux Minecraft location
System.Environment.GetEnvironmentVariable("HOME") } // Tries Linux Minecraft location
) {
if (!Directory.Exists(path)) {
if (!Directory.Exists(basepath)) {
continue;
}
path = Path.Combine(path, ".minecraft", "saves");
string path = Path.Combine(basepath, ".minecraft");
path = Path.Combine(path, "saves");
if (!Directory.Exists(path)) {
continue;