1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-18 11:43:22 +08:00

Merge pull request #31481 from Susko3/update-osu-stable-from-registry

Add new osu!(stable) registry ProgId
This commit is contained in:
Dean Herbert 2025-01-11 14:05:22 +09:00 committed by GitHub
commit afb999970d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -67,7 +67,12 @@ namespace osu.Desktop
{ {
try try
{ {
stableInstallPath = getStableInstallPathFromRegistry(); stableInstallPath = getStableInstallPathFromRegistry("osustable.File.osz");
if (!string.IsNullOrEmpty(stableInstallPath) && checkExists(stableInstallPath))
return stableInstallPath;
stableInstallPath = getStableInstallPathFromRegistry("osu!");
if (!string.IsNullOrEmpty(stableInstallPath) && checkExists(stableInstallPath)) if (!string.IsNullOrEmpty(stableInstallPath) && checkExists(stableInstallPath))
return stableInstallPath; return stableInstallPath;
@ -89,9 +94,9 @@ namespace osu.Desktop
} }
[SupportedOSPlatform("windows")] [SupportedOSPlatform("windows")]
private string? getStableInstallPathFromRegistry() private string? getStableInstallPathFromRegistry(string progId)
{ {
using (RegistryKey? key = Registry.ClassesRoot.OpenSubKey("osu!")) using (RegistryKey? key = Registry.ClassesRoot.OpenSubKey(progId))
return key?.OpenSubKey(WindowsAssociationManager.SHELL_OPEN_COMMAND)?.GetValue(string.Empty)?.ToString()?.Split('"')[1].Replace("osu!.exe", ""); return key?.OpenSubKey(WindowsAssociationManager.SHELL_OPEN_COMMAND)?.GetValue(string.Empty)?.ToString()?.Split('"')[1].Replace("osu!.exe", "");
} }