Move StoragePath implementation to an extension method

This commit is contained in:
Dean Herbert
2021-11-19 16:07:55 +09:00
parent c6c6b04f2b
commit 59e763467f
23 changed files with 58 additions and 37 deletions

View File

@ -16,6 +16,7 @@ using osu.Framework.Extensions.ObjectExtensions;
using osu.Framework.Logging;
using osu.Game.Beatmaps;
using osu.Game.Database;
using osu.Game.Extensions;
using osu.Game.IO;
using osu.Game.Online.API.Requests.Responses;
using osu.Game.Overlays.Notifications;
@ -363,15 +364,15 @@ namespace osu.Game.Tests.Beatmaps.IO
var files = osu.Dependencies.Get<FileStore>();
long originalLength;
using (var stream = files.Storage.GetStream(firstFile.FileInfo.StoragePath))
using (var stream = files.Storage.GetStream(firstFile.FileInfo.GetStoragePath()))
originalLength = stream.Length;
using (var stream = files.Storage.GetStream(firstFile.FileInfo.StoragePath, FileAccess.Write, FileMode.Create))
using (var stream = files.Storage.GetStream(firstFile.FileInfo.GetStoragePath(), FileAccess.Write, FileMode.Create))
stream.WriteByte(0);
var importedSecondTime = await LoadOszIntoOsu(osu);
using (var stream = files.Storage.GetStream(firstFile.FileInfo.StoragePath))
using (var stream = files.Storage.GetStream(firstFile.FileInfo.GetStoragePath()))
Assert.AreEqual(stream.Length, originalLength, "Corruption was not fixed on second import");
// check the newly "imported" beatmap is actually just the restored previous import. since it matches hash.