mirror of
https://github.com/ppy/osu.git
synced 2025-01-26 18:52:55 +08:00
Fix ArchiveModelManagers lookup paths.
This commit is contained in:
parent
f0fdad2f83
commit
51d4da565c
@ -64,7 +64,13 @@ namespace osu.Game.Beatmaps
|
||||
|
||||
protected override string[] HashableFileTypes => new[] { ".osu" };
|
||||
|
||||
protected override string ImportFromStablePath => "Songs";
|
||||
protected override bool CheckStableDirectoryExists(StableStorage stableStorage) => stableStorage.GetSongStorage().ExistsDirectory(".");
|
||||
|
||||
protected override IEnumerable<string> GetStableImportPaths(StableStorage stableStoage)
|
||||
{
|
||||
var songStorage = stableStoage.GetSongStorage();
|
||||
return songStorage.GetDirectories(".").Select(path => songStorage.GetFullPath(path));
|
||||
}
|
||||
|
||||
private readonly RulesetStore rulesets;
|
||||
private readonly BeatmapStore beatmaps;
|
||||
|
@ -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
|
||||
|
@ -73,7 +73,8 @@ namespace osu.Game.Scoring
|
||||
}
|
||||
|
||||
protected override IEnumerable<string> GetStableImportPaths(StableStorage stableStorage)
|
||||
=> stableStorage.GetFiles(ImportFromStablePath).Where(p => HandledExtensions.Any(ext => Path.GetExtension(p)?.Equals(ext, StringComparison.OrdinalIgnoreCase) ?? false));
|
||||
=> stableStorage.GetFiles(ImportFromStablePath).Where(p => HandledExtensions.Any(ext => Path.GetExtension(p)?.Equals(ext, StringComparison.OrdinalIgnoreCase) ?? false))
|
||||
.Select(path => stableStorage.GetFullPath(path));
|
||||
|
||||
public Score GetScore(ScoreInfo score) => new LegacyDatabasedScore(score, rulesets, beatmaps(), Files.Store);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user