From e7e822ecd57c9211fa9c749569e6064eb1a922ca Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 1 Aug 2017 16:37:43 +0900 Subject: [PATCH] Fix StableStorage having "Songs" in the path twice --- osu.Desktop/OsuGameDesktop.cs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/osu.Desktop/OsuGameDesktop.cs b/osu.Desktop/OsuGameDesktop.cs index f1427d2861..88c8a206c8 100644 --- a/osu.Desktop/OsuGameDesktop.cs +++ b/osu.Desktop/OsuGameDesktop.cs @@ -51,6 +51,8 @@ namespace osu.Desktop { protected override string LocateBasePath() { + Func checkExists = p => Directory.Exists(Path.Combine(p, "Songs")); + string stableInstallPath; try @@ -58,19 +60,19 @@ namespace osu.Desktop using (RegistryKey key = Registry.ClassesRoot.OpenSubKey("osu")) stableInstallPath = key?.OpenSubKey(@"shell\open\command")?.GetValue(String.Empty).ToString().Split('"')[1].Replace("osu!.exe", ""); - if (Directory.Exists(stableInstallPath)) + if (checkExists(stableInstallPath)) return stableInstallPath; } catch { } - stableInstallPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), @"osu!", "Songs"); - if (Directory.Exists(stableInstallPath)) + stableInstallPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), @"osu!"); + if (checkExists(stableInstallPath)) return stableInstallPath; - stableInstallPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".osu", "Songs"); - if (Directory.Exists(stableInstallPath)) + stableInstallPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".osu"); + if (checkExists(stableInstallPath)) return stableInstallPath; return null;