mirror of
https://github.com/ppy/osu.git
synced 2025-02-15 15:23:14 +08:00
Handle subdirectories during beatmap stable import
This commit is contained in:
parent
ee8045d507
commit
22c09ec893
@ -1,6 +1,9 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using osu.Framework.IO.Stores;
|
||||
using osu.Framework.Platform;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.IO;
|
||||
@ -13,6 +16,24 @@ namespace osu.Game.Database
|
||||
|
||||
protected override Storage PrepareStableStorage(StableStorage stableStorage) => stableStorage.GetSongStorage();
|
||||
|
||||
protected override IEnumerable<string> GetStableImportPaths(Storage storage)
|
||||
{
|
||||
foreach (string beatmapDirectory in storage.GetDirectories(string.Empty))
|
||||
{
|
||||
var beatmapStorage = storage.GetStorageForDirectory(beatmapDirectory);
|
||||
|
||||
if (!beatmapStorage.GetFiles(string.Empty).ExcludeSystemFileNames().Any())
|
||||
{
|
||||
// if a directory doesn't contain files, attempt looking for beatmaps inside of that directory.
|
||||
// this is a special behaviour in stable for beatmaps only, see https://github.com/ppy/osu/issues/18615.
|
||||
foreach (string beatmapInDirectory in GetStableImportPaths(beatmapStorage))
|
||||
yield return beatmapStorage.GetFullPath(beatmapInDirectory);
|
||||
}
|
||||
else
|
||||
yield return storage.GetFullPath(beatmapDirectory);
|
||||
}
|
||||
}
|
||||
|
||||
public LegacyBeatmapImporter(IModelImporter<BeatmapSetInfo> importer)
|
||||
: base(importer)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user