Fix skin export failing if a directory exists with the proposed filename

This commit is contained in:
Dean Herbert 2023-02-15 16:11:16 +09:00
parent 24961d1ac0
commit e71dfd7555

View File

@ -5,6 +5,7 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using osu.Framework.Platform;
using osu.Game.Extensions;
using osu.Game.Utils;
@ -43,7 +44,10 @@ namespace osu.Game.Database
{
string itemFilename = GetFilename(item).GetValidFilename();
IEnumerable<string> existingExports = exportStorage.GetFiles("", $"{itemFilename}*{FileExtension}");
IEnumerable<string> existingExports =
exportStorage
.GetFiles(string.Empty, $"{itemFilename}*{FileExtension}")
.Concat(exportStorage.GetDirectories(string.Empty));
string filename = NamingUtils.GetNextBestFilename(existingExports, $"{itemFilename}{FileExtension}");
using (var stream = exportStorage.CreateFileSafely(filename))