1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-16 04:22:54 +08:00

Merge branch 'safe-file-writes' into update-framework

This commit is contained in:
Dean Herbert 2022-05-21 15:17:52 +09:00
commit fa1d267b10

View File

@ -11,7 +11,7 @@ namespace osu.Game.IO
/// <summary> /// <summary>
/// A storage which wraps another storage and delegates implementation, potentially mutating the lookup path. /// A storage which wraps another storage and delegates implementation, potentially mutating the lookup path.
/// </summary> /// </summary>
public class WrappedStorage : Storage public class WrappedStorage : NativeStorage // TODO: Revert to Storage inheritance after https://github.com/ppy/osu-framework/pull/5189
{ {
protected Storage UnderlyingStorage { get; private set; } protected Storage UnderlyingStorage { get; private set; }
@ -67,12 +67,10 @@ namespace osu.Game.IO
public override IEnumerable<string> GetFiles(string path, string pattern = "*") => public override IEnumerable<string> GetFiles(string path, string pattern = "*") =>
ToLocalRelative(UnderlyingStorage.GetFiles(MutatePath(path), pattern)); ToLocalRelative(UnderlyingStorage.GetFiles(MutatePath(path), pattern));
public override Stream CreateFileSafely(string path) => UnderlyingStorage.CreateFileSafely(path);
public override Stream GetStream(string path, FileAccess access = FileAccess.Read, FileMode mode = FileMode.OpenOrCreate) => public override Stream GetStream(string path, FileAccess access = FileAccess.Read, FileMode mode = FileMode.OpenOrCreate) =>
UnderlyingStorage.GetStream(MutatePath(path), access, mode); UnderlyingStorage.GetStream(MutatePath(path), access, mode);
public override void Move(string from, string to) => UnderlyingStorage.Move(from, to); public override void Move(string from, string to) => UnderlyingStorage.Move(MutatePath(from), MutatePath(to));
public override bool OpenFileExternally(string filename) => UnderlyingStorage.OpenFileExternally(MutatePath(filename)); public override bool OpenFileExternally(string filename) => UnderlyingStorage.OpenFileExternally(MutatePath(filename));