mirror of
https://github.com/ppy/osu
synced 2025-01-29 17:23:03 +00:00
Fix StoryboardResourceLookupStore
dying on failure to unmap path
Before the introduction of `StoryboardResourceLookupStore`, missing files would softly fail by use of null fallbacks. After the aforementioned class was added, however, the fallbacks would not work anymore if for whatever reason `GetStoragePathFromStoryboardPath()` failed to unmap the storyboard asset name to a storage path.
This commit is contained in:
parent
aea7f81f1c
commit
ba518e1da8
@ -142,14 +142,32 @@ namespace osu.Game.Storyboards.Drawables
|
||||
public void Dispose() =>
|
||||
realmFileStore.Dispose();
|
||||
|
||||
public byte[] Get(string name) =>
|
||||
realmFileStore.Get(storyboard.GetStoragePathFromStoryboardPath(name));
|
||||
public byte[] Get(string name)
|
||||
{
|
||||
string? storagePath = storyboard.GetStoragePathFromStoryboardPath(name);
|
||||
|
||||
public Task<byte[]> GetAsync(string name, CancellationToken cancellationToken = new CancellationToken()) =>
|
||||
realmFileStore.GetAsync(storyboard.GetStoragePathFromStoryboardPath(name), cancellationToken);
|
||||
return string.IsNullOrEmpty(storagePath)
|
||||
? null!
|
||||
: realmFileStore.Get(storagePath);
|
||||
}
|
||||
|
||||
public Stream GetStream(string name) =>
|
||||
realmFileStore.GetStream(storyboard.GetStoragePathFromStoryboardPath(name));
|
||||
public Task<byte[]> GetAsync(string name, CancellationToken cancellationToken = new CancellationToken())
|
||||
{
|
||||
string? storagePath = storyboard.GetStoragePathFromStoryboardPath(name);
|
||||
|
||||
return string.IsNullOrEmpty(storagePath)
|
||||
? Task.FromResult<byte[]>(null!)
|
||||
: realmFileStore.GetAsync(storagePath, cancellationToken);
|
||||
}
|
||||
|
||||
public Stream? GetStream(string name)
|
||||
{
|
||||
string? storagePath = storyboard.GetStoragePathFromStoryboardPath(name);
|
||||
|
||||
return string.IsNullOrEmpty(storagePath)
|
||||
? null
|
||||
: realmFileStore.GetStream(storagePath);
|
||||
}
|
||||
|
||||
public IEnumerable<string> GetAvailableResources() =>
|
||||
realmFileStore.GetAvailableResources();
|
||||
|
Loading…
Reference in New Issue
Block a user