Fix ArchiveModelManagers lookup paths.

This commit is contained in:
Lucas A
2021-01-24 22:25:49 +01:00
parent f0fdad2f83
commit 51d4da565c
3 changed files with 18 additions and 5 deletions

View File

@ -637,10 +637,16 @@ namespace osu.Game.Database
/// </summary>
protected virtual string ImportFromStablePath => null;
/// <summary>
/// Checks for the existence of an osu-stable directory.
/// </summary>
protected virtual bool CheckStableDirectoryExists(StableStorage stableStorage) => stableStorage.ExistsDirectory(ImportFromStablePath);
/// <summary>
/// Select paths to import from stable. Default implementation iterates all directories in <see cref="ImportFromStablePath"/>.
/// </summary>
protected virtual IEnumerable<string> GetStableImportPaths(StableStorage stableStoage) => stableStoage.GetDirectories(ImportFromStablePath);
protected virtual IEnumerable<string> GetStableImportPaths(StableStorage stableStoage) => stableStoage.GetDirectories(ImportFromStablePath)
.Select(path => stableStoage.GetFullPath(path));
/// <summary>
/// Whether this specified path should be removed after successful import.
@ -662,14 +668,14 @@ namespace osu.Game.Database
return Task.CompletedTask;
}
if (!stable.ExistsDirectory(ImportFromStablePath))
if (!CheckStableDirectoryExists(stable))
{
// This handles situations like when the user does not have a Skins folder
Logger.Log($"No {ImportFromStablePath} folder available in osu!stable installation", LoggingTarget.Information, LogLevel.Error);
return Task.CompletedTask;
}
return Task.Run(async () => await Import(GetStableImportPaths(GetStableStorage()).Select(f => stable.GetFullPath(f)).ToArray()));
return Task.Run(async () => await Import(GetStableImportPaths(stable).ToArray()));
}
#endregion