1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-23 07:18:45 +08:00

Add note about expensive operation

This commit is contained in:
Dean Herbert 2024-12-10 16:44:35 +09:00
parent 3cac583754
commit bbaa542d4a
No known key found for this signature in database

View File

@ -148,14 +148,17 @@ namespace osu.Game.Screens.Edit.Setup
{
foreach (var b in otherBeatmaps)
{
if (readFilename(b.Metadata) != newFilename)
{
writeFilename(b.Metadata, newFilename);
// This operation is quite expensive, so only perform it if required.
if (readFilename(b.Metadata) == newFilename) continue;
// save the difficulty to re-encode the .osu file, updating any reference of the old filename.
var beatmapWorking = beatmaps.GetWorkingBeatmap(b);
beatmaps.Save(b, beatmapWorking.Beatmap, beatmapWorking.GetSkin());
}
writeFilename(b.Metadata, newFilename);
// save the difficulty to re-encode the .osu file, updating any reference of the old filename.
//
// note that this triggers a full save flow, including triggering a difficulty calculation.
// this is not a cheap operation and should be reconsidered in the future.
var beatmapWorking = beatmaps.GetWorkingBeatmap(b);
beatmaps.Save(b, beatmapWorking.Beatmap, beatmapWorking.GetSkin());
}
}