mirror of
https://github.com/ppy/osu.git
synced 2025-02-15 04:52:57 +08:00
Merge pull request #22860 from rozukke/fix-skin-ini-import
Fix import of skins with non-ASCII names that have been previously exported by lazer
This commit is contained in:
commit
0a19b1e9cf
@ -133,6 +133,25 @@ namespace osu.Game.Tests.Skins.IO
|
|||||||
assertImportedOnce(import1, import2);
|
assertImportedOnce(import1, import2);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public Task TestImportExportedNonAsciiSkinFilename() => runSkinTest(async osu =>
|
||||||
|
{
|
||||||
|
MemoryStream exportStream = new MemoryStream();
|
||||||
|
|
||||||
|
var import1 = await loadSkinIntoOsu(osu, new ImportTask(createOskWithIni("name 『1』", "author 1"), "custom.osk"));
|
||||||
|
assertCorrectMetadata(import1, "name 『1』 [custom]", "author 1", osu);
|
||||||
|
|
||||||
|
import1.PerformRead(s =>
|
||||||
|
{
|
||||||
|
new LegacySkinExporter(osu.Dependencies.Get<Storage>()).ExportModelTo(s, exportStream);
|
||||||
|
});
|
||||||
|
|
||||||
|
string exportFilename = import1.GetDisplayString().GetValidFilename();
|
||||||
|
|
||||||
|
var import2 = await loadSkinIntoOsu(osu, new ImportTask(exportStream, $"{exportFilename}.osk"));
|
||||||
|
assertCorrectMetadata(import2, "name 『1』 [custom]", "author 1", osu);
|
||||||
|
});
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public Task TestSameMetadataNameSameFolderName([Values] bool batchImport) => runSkinTest(async osu =>
|
public Task TestSameMetadataNameSameFolderName([Values] bool batchImport) => runSkinTest(async osu =>
|
||||||
{
|
{
|
||||||
|
@ -101,7 +101,8 @@ namespace osu.Game.Skinning
|
|||||||
// In both of these cases, the expectation from the user is that the filename or folder name is displayed somewhere to identify the skin.
|
// In both of these cases, the expectation from the user is that the filename or folder name is displayed somewhere to identify the skin.
|
||||||
if (archiveName != item.Name
|
if (archiveName != item.Name
|
||||||
// lazer exports use this format
|
// lazer exports use this format
|
||||||
&& archiveName != item.GetDisplayString())
|
// GetValidFilename accounts for skins with non-ASCII characters in the name that have been exported by lazer.
|
||||||
|
&& archiveName != item.GetDisplayString().GetValidFilename())
|
||||||
item.Name = @$"{item.Name} [{archiveName}]";
|
item.Name = @$"{item.Name} [{archiveName}]";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user