From 64dfce258ff1b561120bc0e6c23f5e2872e93db3 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 17 Oct 2017 17:08:19 +0900 Subject: [PATCH] Fix file prefix not being read when calling storage.Exists --- osu.Game/IO/FileStore.cs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/osu.Game/IO/FileStore.cs b/osu.Game/IO/FileStore.cs index b60d82d61c..db4f5fd2a2 100644 --- a/osu.Game/IO/FileStore.cs +++ b/osu.Game/IO/FileStore.cs @@ -18,21 +18,21 @@ namespace osu.Game.IO /// public class FileStore : DatabaseBackedStore { - private const string prefix = "files"; + public readonly IResourceStore Store; - public readonly ResourceStore Store; + public Storage Storage => base.Storage; - public FileStore(Func getContext, Storage storage) : base(getContext, storage) + public FileStore(Func getContext, Storage storage) : base(getContext, storage.GetStorageForDirectory(@"files")) { - Store = new NamespacedResourceStore(new StorageBackedResourceStore(storage), prefix); + Store = new StorageBackedResourceStore(Storage); } protected override void Prepare(bool reset = false) { if (reset) { - if (Storage.ExistsDirectory(prefix)) - Storage.DeleteDirectory(prefix); + if (Storage.ExistsDirectory(string.Empty)) + Storage.DeleteDirectory(string.Empty); GetContext().Database.ExecuteSqlCommand("DELETE FROM FileInfo"); } @@ -54,7 +54,7 @@ namespace osu.Game.IO var info = existing ?? new FileInfo { Hash = hash }; - string path = Path.Combine(prefix, info.StoragePath); + string path = info.StoragePath; // we may be re-adding a file to fix missing store entries. if (!Storage.Exists(path)) @@ -109,7 +109,7 @@ namespace osu.Game.IO { try { - Storage.Delete(Path.Combine(prefix, f.StoragePath)); + Storage.Delete(f.StoragePath); context.FileInfo.Remove(f); } catch (Exception e)