1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-13 16:47:46 +08:00

Copy .ico files when publishing

These icons should appear in end-user installation folder.
This commit is contained in:
Susko3 2024-02-05 14:03:16 +01:00
parent 01efd1b353
commit 7789cc01eb
4 changed files with 31 additions and 3 deletions

View File

@ -0,0 +1,10 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
namespace osu.Desktop.Windows
{
public static class Icons
{
public static Win32Icon Lazer => new Win32Icon(@"lazer.ico");
}
}

View File

@ -0,0 +1,16 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
namespace osu.Desktop.Windows
{
public record Win32Icon
{
public readonly string Path;
internal Win32Icon(string name)
{
string dir = System.IO.Path.GetDirectoryName(typeof(Win32Icon).Assembly.Location)!;
Path = System.IO.Path.Join(dir, name);
}
}
}

View File

@ -10,7 +10,6 @@ using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Localisation;
using osu.Framework.Logging;
using osu.Game.Resources.Icons;
using osu.Game.Localisation;
namespace osu.Desktop.Windows
@ -194,7 +193,7 @@ namespace osu.Desktop.Windows
using (var programKey = classes.CreateSubKey(programId))
{
using (var defaultIconKey = programKey.CreateSubKey(DEFAULT_ICON))
defaultIconKey.SetValue(null, Icon.RegistryString);
defaultIconKey.SetValue(null, Icon.Path);
using (var openCommandKey = programKey.CreateSubKey(SHELL_OPEN_COMMAND))
openCommandKey.SetValue(null, $@"""{exePath}"" ""%1""");
@ -249,7 +248,7 @@ namespace osu.Desktop.Windows
protocolKey.SetValue(URL_PROTOCOL, string.Empty);
using (var defaultIconKey = protocolKey.CreateSubKey(DEFAULT_ICON))
defaultIconKey.SetValue(null, Icon.RegistryString);
defaultIconKey.SetValue(null, Icon.Path);
using (var openCommandKey = protocolKey.CreateSubKey(SHELL_OPEN_COMMAND))
openCommandKey.SetValue(null, $@"""{exePath}"" ""%1""");

View File

@ -31,4 +31,7 @@
<ItemGroup Label="Resources">
<EmbeddedResource Include="lazer.ico" />
</ItemGroup>
<ItemGroup Label="Windows Icons" Condition="$(RuntimeIdentifier.StartsWith('win'))">
<Content Include="*.ico" CopyToOutputDirectory="PreserveNewest" CopyToPublishDirectory="PreserveNewest" />
</ItemGroup>
</Project>