Address remaining reviews suggestions.

This commit is contained in:
Lucas A
2021-01-26 20:35:42 +01:00
parent 2a2b6f347e
commit 383c40b992
3 changed files with 7 additions and 6 deletions

View File

@ -64,7 +64,7 @@ namespace osu.Game.Beatmaps
protected override string[] HashableFileTypes => new[] { ".osu" }; protected override string[] HashableFileTypes => new[] { ".osu" };
protected override bool CheckStableDirectoryExists(StableStorage stableStorage) => stableStorage.GetSongStorage().ExistsDirectory("."); protected override bool StableDirectoryExists(StableStorage stableStorage) => stableStorage.GetSongStorage().ExistsDirectory(".");
protected override IEnumerable<string> GetStableImportPaths(StableStorage stableStorage) protected override IEnumerable<string> GetStableImportPaths(StableStorage stableStorage)
{ {

View File

@ -640,10 +640,10 @@ namespace osu.Game.Database
/// <summary> /// <summary>
/// Checks for the existence of an osu-stable directory. /// Checks for the existence of an osu-stable directory.
/// </summary> /// </summary>
protected virtual bool CheckStableDirectoryExists(StableStorage stableStorage) => stableStorage.ExistsDirectory(ImportFromStablePath); protected virtual bool StableDirectoryExists(StableStorage stableStorage) => stableStorage.ExistsDirectory(ImportFromStablePath);
/// <summary> /// <summary>
/// Select paths to import from stable. Default implementation iterates all directories in <see cref="ImportFromStablePath"/>. /// Select paths to import from stable where all paths should be absolute. Default implementation iterates all directories in <see cref="ImportFromStablePath"/>.
/// </summary> /// </summary>
protected virtual IEnumerable<string> GetStableImportPaths(StableStorage stableStorage) => stableStorage.GetDirectories(ImportFromStablePath) protected virtual IEnumerable<string> GetStableImportPaths(StableStorage stableStorage) => stableStorage.GetDirectories(ImportFromStablePath)
.Select(path => stableStorage.GetFullPath(path)); .Select(path => stableStorage.GetFullPath(path));
@ -668,7 +668,7 @@ namespace osu.Game.Database
return Task.CompletedTask; return Task.CompletedTask;
} }
if (!CheckStableDirectoryExists(stable)) if (!StableDirectoryExists(stable))
{ {
// This handles situations like when the user does not have a Skins folder // 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); Logger.Log($"No {ImportFromStablePath} folder available in osu!stable installation", LoggingTarget.Information, LogLevel.Error);

View File

@ -35,12 +35,13 @@ namespace osu.Game.IO
{ {
var songsDirectoryPath = Path.Combine(BasePath, stable_default_songs_path); var songsDirectoryPath = Path.Combine(BasePath, stable_default_songs_path);
var configFile = GetFiles(".", "osu!.*.cfg").FirstOrDefault(); var configFile = GetFiles(".", "osu!.*.cfg").SingleOrDefault();
if (configFile == null) if (configFile == null)
return songsDirectoryPath; return songsDirectoryPath;
using (var textReader = new StreamReader(GetStream(configFile))) using (var stream = GetStream(configFile))
using (var textReader = new StreamReader(stream))
{ {
string line; string line;