1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-12 15:22:55 +08:00

Fix skin version being incorrectly set to 1.0 when skin is missing skin.ini

Closes https://github.com/ppy/osu/issues/24939.
This commit is contained in:
Dean Herbert 2023-09-27 16:45:38 +09:00
parent 84682b4227
commit c44cca2c23
2 changed files with 13 additions and 2 deletions

View File

@ -105,7 +105,14 @@ namespace osu.Game.Skinning
Debug.Assert(Configuration != null);
}
else
Configuration = new SkinConfiguration();
{
Configuration = new SkinConfiguration
{
// generally won't be hit as we always write a `skin.ini` on import, but best be safe than sorry.
// see https://github.com/peppy/osu-stable-reference/blob/1531237b63392e82c003c712faa028406073aa8f/osu!/Graphics/Skinning/SkinManager.cs#L297-L298
LegacyVersion = SkinConfiguration.LATEST_VERSION,
};
}
// skininfo files may be null for default skin.
foreach (SkinComponentsContainerLookup.TargetArea skinnableTarget in Enum.GetValues<SkinComponentsContainerLookup.TargetArea>())

View File

@ -118,7 +118,7 @@ namespace osu.Game.Skinning
string nameLine = @$"Name: {item.Name}";
string authorLine = @$"Author: {item.Creator}";
string[] newLines =
List<string> newLines = new List<string>
{
@"// The following content was automatically added by osu! during import, based on filename / folder metadata.",
@"[General]",
@ -130,6 +130,10 @@ namespace osu.Game.Skinning
if (existingFile == null)
{
// skins without a skin.ini are supposed to import using the "latest version" spec.
// see https://github.com/peppy/osu-stable-reference/blob/1531237b63392e82c003c712faa028406073aa8f/osu!/Graphics/Skinning/SkinManager.cs#L297-L298
newLines.Add($"Version: {SkinConfiguration.LATEST_VERSION}");
// In the case a skin doesn't have a skin.ini yet, let's create one.
writeNewSkinIni();
}