Add Linux Minecraft location

This commit is contained in:
teambob 2023-12-25 17:48:15 +11:00 committed by GitHub
parent 15b1b2891f
commit 2140894905
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -257,19 +257,23 @@ namespace NBTExplorer.Windows
return;
try {
string path = Environment.ExpandEnvironmentVariables("%APPDATA%");
if (!Directory.Exists(path)) {
path = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
foreach (string path in new[] {
Environment.ExpandEnvironmentVariables("%APPDATA%"),
Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
Environment.GetFolderPath(Environment.SpecialFolder.UserProfile) } // Tries Linux Minecraft location
) {
if (!Directory.Exists(path)) {
continue;
}
path = Path.Combine(path, ".minecraft", "saves");
if (!Directory.Exists(path)) {
continue;
}
OpenPaths(new string[] { path });
}
path = Path.Combine(path, ".minecraft");
path = Path.Combine(path, "saves");
if (!Directory.Exists(path)) {
path = Environment.GetFolderPath(Environment.SpecialFolder.MyComputer);
}
OpenPaths(new string[] { path });
}
catch (Exception e) {
MessageBox.Show("Could not open default Minecraft save directory");