Skip to content

Fix skins containing subdirectories breaking on external edit on windows #33999

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 4, 2025

Conversation

bdach
Copy link
Collaborator

@bdach bdach commented Jul 3, 2025

For anyone who broke their skins because of this, this change also allows them to be retroactively fixed by starting an external edit operation and immediately finishing it (you don't need to make any changes to the skin files).


Closes #33994.

The reason for the breakage is that Directory.EnumerateFiles() used in

string[] filesInMountedDirectory = Directory.EnumerateFiles(task.Path, "*.*", SearchOption.AllDirectories).Select(f => Path.GetRelativePath(task.Path, f)).ToArray();

will use the primary platform directory separator character, which is \ on windows and / on unices. The internal realm storage structure is expecting paths to be normalised to the unix convention, which is evident in

yield return (file, file.Substring(prefix.Length).ToStandardisedPath());

on the write side and in

string? path = getPathForFile(filename.ToStandardisedPath());

on the read side.

Rather than applying this locally to the skin importer I kinda think it's better to have this call in ModelManager to hopefully avoid future footgunnage of this kind.

Closes ppy#33994.

The reason for the breakage is that `Directory.EnumerateFiles()` used in

	https://github.com/ppy/osu/blob/b1435d35e56eed08a57d1909fa0b16e67bd9c2a2/osu.Game/Skinning/SkinImporter.cs#L63

will use the primary platform directory separator character, which is
`\` on windows and `/` on unices. The internal realm storage structure
is expecting paths to be normalised to the unix convention, which is
evident in

	https://github.com/ppy/osu/blob/b1435d35e56eed08a57d1909fa0b16e67bd9c2a2/osu.Game/Database/RealmArchiveModelImporter.cs#L499

on the write side and in

	https://github.com/ppy/osu/blob/b1435d35e56eed08a57d1909fa0b16e67bd9c2a2/osu.Game/Skinning/RealmBackedResourceStore.cs#L50

on the read side.

Rather than applying this locally to the skin importer I kinda think
it's better to have this call in `ModelManager` to hopefully avoid
future footgunnage of this kind.
@bdach bdach self-assigned this Jul 3, 2025
@bdach bdach added realm deals with local realm database platform/windows area:skin-editor next release Pull requests which are almost there. We'll aim to get them in the next release, but no guarantees! labels Jul 3, 2025
@peppy peppy self-requested a review July 4, 2025 02:49
@peppy peppy merged commit cac9844 into ppy:master Jul 4, 2025
7 of 9 checks passed
@bdach bdach deleted the external-skin-edit-eats-folders branch July 4, 2025 03:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:skin-editor next release Pull requests which are almost there. We'll aim to get them in the next release, but no guarantees! platform/windows realm deals with local realm database size/XS
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Saving changes to skin edited externally causes hitcircle numbers to disappear
2 participants