1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-21 23:36:10 +08:00

Clear out old protocol data when installing

If we're the only capable app, windows will open us by default.
This commit is contained in:
Susko3 2025-01-07 00:07:04 +00:00
parent 31bf162db6
commit 2381975359

View File

@ -329,11 +329,9 @@ namespace osu.Desktop.Windows
{
protocolKey.SetValue(URL_PROTOCOL, string.Empty);
using (var defaultIconKey = protocolKey.CreateSubKey(default_icon))
defaultIconKey.SetValue(null, IconPath);
using (var openCommandKey = protocolKey.CreateSubKey(SHELL_OPEN_COMMAND))
openCommandKey.SetValue(null, $@"""{exe_path}"" ""%1""");
// clear out old data
protocolKey.DeleteSubKeyTree(default_icon, throwOnMissingSubKey: false);
protocolKey.DeleteSubKeyTree(@"Shell", throwOnMissingSubKey: false);
}
// register a program id for the given protocol
@ -360,7 +358,6 @@ namespace osu.Desktop.Windows
{
using var classes = Registry.CurrentUser.OpenSubKey(software_classes, true);
classes?.DeleteSubKeyTree(ProgramId, throwOnMissingSubKey: false);
classes?.DeleteSubKeyTree(Protocol, throwOnMissingSubKey: false);
}
}
}