mirror of
https://github.com/jaquadro/NBTExplorer.git
synced 2025-01-25 00:36:26 +00:00
Add Linux Minecraft location
This commit is contained in:
parent
15b1b2891f
commit
2140894905
1 changed files with 16 additions and 12 deletions
|
@ -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");
|
||||
|
|
Loading…
Reference in a new issue