mirror of
https://github.com/ppy/osu.git
synced 2025-02-19 20:02:57 +08:00
Construct a DesktopStorage pointing to the absolute path of the song directory.
This commit is contained in:
parent
d71ac83428
commit
f0fdad2f83
@ -29,20 +29,14 @@ namespace osu.Game.IO
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns a <see cref="Storage"/> pointing to the osu-stable Songs directory.
|
/// Returns a <see cref="Storage"/> pointing to the osu-stable Songs directory.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Storage GetSongStorage()
|
public Storage GetSongStorage() => new DesktopStorage(songs_path, host);
|
||||||
{
|
|
||||||
if (songs_path.Equals(stable_songs_path, StringComparison.OrdinalIgnoreCase))
|
|
||||||
return GetStorageForDirectory(stable_songs_path);
|
|
||||||
else
|
|
||||||
return new DesktopStorage(songs_path, host);
|
|
||||||
}
|
|
||||||
|
|
||||||
private string locateSongsDirectory()
|
private string locateSongsDirectory()
|
||||||
{
|
{
|
||||||
var configFile = GetStream(GetFiles(".", "osu!.*.cfg").First());
|
var configFile = GetStream(GetFiles(".", "osu!.*.cfg").First());
|
||||||
var textReader = new StreamReader(configFile);
|
var textReader = new StreamReader(configFile);
|
||||||
|
|
||||||
var songs_directory_path = stable_songs_path;
|
var songs_directory_path = Path.Combine(BasePath, stable_songs_path);
|
||||||
|
|
||||||
while (!textReader.EndOfStream)
|
while (!textReader.EndOfStream)
|
||||||
{
|
{
|
||||||
@ -51,7 +45,7 @@ namespace osu.Game.IO
|
|||||||
if (line?.StartsWith("BeatmapDirectory", StringComparison.OrdinalIgnoreCase) == true)
|
if (line?.StartsWith("BeatmapDirectory", StringComparison.OrdinalIgnoreCase) == true)
|
||||||
{
|
{
|
||||||
var directory = line.Split('=')[1].TrimStart();
|
var directory = line.Split('=')[1].TrimStart();
|
||||||
if (Path.IsPathFullyQualified(directory) && !directory.Equals(stable_songs_path, StringComparison.OrdinalIgnoreCase))
|
if (Path.IsPathFullyQualified(directory))
|
||||||
songs_directory_path = directory;
|
songs_directory_path = directory;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user