mirror of
https://github.com/ppy/osu.git
synced 2024-11-13 18:47:27 +08:00
make LegacyExporter
use NamingUtils.GetNextBestFilename()
This commit is contained in:
parent
8412a44179
commit
8b856f1c89
@ -3,9 +3,9 @@
|
|||||||
|
|
||||||
#nullable disable
|
#nullable disable
|
||||||
|
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
|
||||||
using osu.Framework.Platform;
|
using osu.Framework.Platform;
|
||||||
using osu.Game.Extensions;
|
using osu.Game.Extensions;
|
||||||
using osu.Game.Utils;
|
using osu.Game.Utils;
|
||||||
@ -42,11 +42,9 @@ namespace osu.Game.Database
|
|||||||
{
|
{
|
||||||
string itemFilename = item.GetDisplayString().GetValidFilename();
|
string itemFilename = item.GetDisplayString().GetValidFilename();
|
||||||
|
|
||||||
IEnumerable<string> existingExports = exportStorage
|
IEnumerable<string> existingExports = exportStorage.GetFiles("", $"{itemFilename}*{FileExtension}");
|
||||||
.GetFiles("", $"{itemFilename}*{FileExtension}")
|
|
||||||
.Select(export => export.Substring(0, export.Length - FileExtension.Length));
|
|
||||||
|
|
||||||
string filename = $"{NamingUtils.GetNextBestName(existingExports, itemFilename)}{FileExtension}";
|
string filename = NamingUtils.GetNextBestFilename(existingExports, itemFilename, FileExtension);
|
||||||
using (var stream = exportStorage.CreateFileSafely(filename))
|
using (var stream = exportStorage.CreateFileSafely(filename))
|
||||||
ExportModelTo(item, stream);
|
ExportModelTo(item, stream);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user