mirror of
https://github.com/osukey/osukey.git
synced 2025-08-06 16:13:57 +09:00
Refactor paths
This commit is contained in:
@ -31,7 +31,7 @@ namespace osu.Game.Tournament
|
|||||||
public readonly TournamentVideoStorage VideoStorage;
|
public readonly TournamentVideoStorage VideoStorage;
|
||||||
|
|
||||||
public TournamentStorage(GameHost host)
|
public TournamentStorage(GameHost host)
|
||||||
: base(host.Storage, string.Empty)
|
: base(host.Storage.GetStorageForDirectory("tournaments"), string.Empty)
|
||||||
{
|
{
|
||||||
this.host = host;
|
this.host = host;
|
||||||
|
|
||||||
@ -40,11 +40,10 @@ namespace osu.Game.Tournament
|
|||||||
|
|
||||||
if (!string.IsNullOrEmpty(currentTournament))
|
if (!string.IsNullOrEmpty(currentTournament))
|
||||||
{
|
{
|
||||||
ChangeTargetStorage(UnderlyingStorage.GetStorageForDirectory("tournaments" + Path.DirectorySeparatorChar + currentTournament));
|
ChangeTargetStorage(UnderlyingStorage.GetStorageForDirectory(currentTournament));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Migrating old storage format to the new one.
|
|
||||||
migrate();
|
migrate();
|
||||||
Logger.Log("Migrating files from old storage to new.");
|
Logger.Log("Migrating files from old storage to new.");
|
||||||
}
|
}
|
||||||
@ -55,8 +54,8 @@ namespace osu.Game.Tournament
|
|||||||
|
|
||||||
private void migrate()
|
private void migrate()
|
||||||
{
|
{
|
||||||
const string default_path = "tournaments/default";
|
const string default_path = "default";
|
||||||
var source = new DirectoryInfo(GetFullPath("tournament"));
|
var source = new DirectoryInfo(host.Storage.GetFullPath("tournament"));
|
||||||
var destination = new DirectoryInfo(GetFullPath(default_path));
|
var destination = new DirectoryInfo(GetFullPath(default_path));
|
||||||
|
|
||||||
Directory.CreateDirectory(destination.FullName);
|
Directory.CreateDirectory(destination.FullName);
|
||||||
@ -64,7 +63,7 @@ namespace osu.Game.Tournament
|
|||||||
if (host.Storage.Exists("bracket.json"))
|
if (host.Storage.Exists("bracket.json"))
|
||||||
{
|
{
|
||||||
Logger.Log("Migrating bracket to default tournament storage.");
|
Logger.Log("Migrating bracket to default tournament storage.");
|
||||||
var bracketFile = new System.IO.FileInfo(GetFullPath(string.Empty) + Path.DirectorySeparatorChar + GetFiles(string.Empty, "bracket.json").First());
|
var bracketFile = new System.IO.FileInfo(host.Storage.GetFullPath("bracket.json"));
|
||||||
attemptOperation(() => bracketFile.CopyTo(Path.Combine(destination.FullName, bracketFile.Name), true));
|
attemptOperation(() => bracketFile.CopyTo(Path.Combine(destination.FullName, bracketFile.Name), true));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user