1
0
mirror of https://github.com/ppy/osu.git synced 2026-05-19 03:19:52 +08:00

Merge pull request #17708 from frenzibyte/fix-texture-lookups-no-longer-handling-paths

Fix skin texture lookups not handling paths with extensions
This commit is contained in:
Dean Herbert
2022-04-07 22:01:40 +09:00
committed by GitHub
Unverified
2 changed files with 15 additions and 3 deletions
@@ -83,6 +83,20 @@ namespace osu.Game.Tests.NonVisual.Skinning
"followpoint.png",
"followpoint@2x.png", 2
},
new object[]
{
// Looking up a path with extension specified should work.
new[] { "Gameplay/osu/followpoint.png" },
"Gameplay/osu/followpoint.png",
"Gameplay/osu/followpoint.png", 1
},
new object[]
{
// Looking up a path with extension specified should also work with @2x sprites.
new[] { "Gameplay/osu/followpoint@2x.png" },
"Gameplay/osu/followpoint.png",
"Gameplay/osu/followpoint@2x.png", 2
},
};
[TestCaseSource(nameof(fallbackTestCases))]
+1 -3
View File
@@ -443,9 +443,7 @@ namespace osu.Game.Skinning
string lookupName = name.Replace(@"@2x", string.Empty);
float ratio = 2;
string twoTimesFilename = Path.HasExtension(lookupName)
? @$"{Path.GetFileNameWithoutExtension(lookupName)}@2x{Path.GetExtension(lookupName)}"
: @$"{lookupName}@2x";
string twoTimesFilename = $"{Path.ChangeExtension(lookupName, null)}@2x{Path.GetExtension(lookupName)}";
var texture = Textures?.Get(twoTimesFilename, wrapModeS, wrapModeT);