1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-28 05:22:54 +08:00

GetFilename and something other

https://github.com/ppy/osu/pull/21739
This commit is contained in:
cdwcgt 2023-02-17 22:23:50 +09:00
parent 29d6483e17
commit 843d841f5a

View File

@ -32,10 +32,10 @@ namespace osu.Game.Database
protected Storage UserFileStorage;
private readonly Storage exportStorage;
protected virtual string GetFilename(TModel item) => item.GetDisplayString();
private readonly RealmAccess realmAccess;
private string filename = string.Empty;
public Action<Notification>? PostNotification { get; set; }
/// <summary>
@ -62,9 +62,12 @@ namespace osu.Game.Database
/// <returns></returns>
public async Task ExportAsync(TModel model, CancellationToken? cancellationToken = null)
{
string itemFilename = model.GetDisplayString().GetValidFilename();
IEnumerable<string> existingExports = exportStorage.GetFiles("", $"{itemFilename}*{FileExtension}");
filename = NamingUtils.GetNextBestFilename(existingExports, $"{itemFilename}{FileExtension}");
string itemFilename = GetFilename(model).GetValidFilename();
IEnumerable<string> existingExports =
exportStorage
.GetFiles(string.Empty, $"{itemFilename}*{FileExtension}")
.Concat(exportStorage.GetDirectories(string.Empty));
string filename = NamingUtils.GetNextBestFilename(existingExports, $"{itemFilename}{FileExtension}");
bool success;
ProgressNotification notification = new ProgressNotification