Allow files missing on disk to be restored on beatmap import

Previously, in the rare case the database became out of sync with the disk store, it was impossible to feasibly repair a beatmap. Now reimporting checks each file exists on disk and adds it back if it doesn't.
This commit is contained in:
Dean Herbert
2017-09-19 18:34:58 +09:00
parent 4a0370a68a
commit c41ca10715
2 changed files with 25 additions and 16 deletions

View File

@ -429,6 +429,15 @@ namespace osu.Game.Beatmaps
if (beatmapSet != null)
{
Undelete(beatmapSet);
// ensure all files are present and accessible
foreach (var f in beatmapSet.Files)
{
if (!storage.Exists(f.FileInfo.StoragePath))
using (Stream s = reader.GetStream(f.Filename))
files.Add(s, false);
}
return beatmapSet;
}