From d5103f6f1ae491ff121073848d6598f10f815894 Mon Sep 17 00:00:00 2001 From: Andrew Punch Date: Mon, 25 Dec 2023 22:02:02 +1100 Subject: [PATCH] Look for Minecraft directory on Linux --- NBTExplorer/Windows/MainForm.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/NBTExplorer/Windows/MainForm.cs b/NBTExplorer/Windows/MainForm.cs index 8127663..c3d43e0 100644 --- a/NBTExplorer/Windows/MainForm.cs +++ b/NBTExplorer/Windows/MainForm.cs @@ -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;