mirror of
https://github.com/osukey/osukey.git
synced 2025-08-07 00:23:59 +09:00
Implement migrations for the drawings config file
This commit is contained in:
@ -17,6 +17,7 @@ namespace osu.Game.Tournament.IO
|
|||||||
internal readonly TournamentVideoResourceStore VideoStore;
|
internal readonly TournamentVideoResourceStore VideoStore;
|
||||||
internal readonly Storage ConfigurationStorage;
|
internal readonly Storage ConfigurationStorage;
|
||||||
private const string default_tournament = "default";
|
private const string default_tournament = "default";
|
||||||
|
private const string config_directory = "config";
|
||||||
|
|
||||||
public TournamentStorage(GameHost host)
|
public TournamentStorage(GameHost host)
|
||||||
: base(host.Storage.GetStorageForDirectory("tournaments"), string.Empty)
|
: base(host.Storage.GetStorageForDirectory("tournaments"), string.Empty)
|
||||||
@ -39,7 +40,7 @@ namespace osu.Game.Tournament.IO
|
|||||||
ChangeTargetStorage(UnderlyingStorage.GetStorageForDirectory(default_tournament));
|
ChangeTargetStorage(UnderlyingStorage.GetStorageForDirectory(default_tournament));
|
||||||
}
|
}
|
||||||
|
|
||||||
ConfigurationStorage = UnderlyingStorage.GetStorageForDirectory("config");
|
ConfigurationStorage = UnderlyingStorage.GetStorageForDirectory(config_directory);
|
||||||
|
|
||||||
VideoStore = new TournamentVideoResourceStore(this);
|
VideoStore = new TournamentVideoResourceStore(this);
|
||||||
Logger.Log("Using tournament storage: " + GetFullPath(string.Empty));
|
Logger.Log("Using tournament storage: " + GetFullPath(string.Empty));
|
||||||
@ -49,10 +50,14 @@ namespace osu.Game.Tournament.IO
|
|||||||
{
|
{
|
||||||
var source = new DirectoryInfo(host.Storage.GetFullPath("tournament"));
|
var source = new DirectoryInfo(host.Storage.GetFullPath("tournament"));
|
||||||
var destination = new DirectoryInfo(GetFullPath(default_tournament));
|
var destination = new DirectoryInfo(GetFullPath(default_tournament));
|
||||||
|
var cfgDestination = new DirectoryInfo(GetFullPath(default_tournament + Path.DirectorySeparatorChar + config_directory));
|
||||||
|
|
||||||
if (!destination.Exists)
|
if (!destination.Exists)
|
||||||
destination.Create();
|
destination.Create();
|
||||||
|
|
||||||
|
if (!cfgDestination.Exists)
|
||||||
|
destination.CreateSubdirectory(config_directory);
|
||||||
|
|
||||||
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.");
|
||||||
@ -67,6 +72,13 @@ namespace osu.Game.Tournament.IO
|
|||||||
moveFile(drawingsFile, destination);
|
moveFile(drawingsFile, destination);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (host.Storage.Exists("drawings.ini"))
|
||||||
|
{
|
||||||
|
Logger.Log("Migrating drawing configuration to default tournament storage.");
|
||||||
|
var drawingsConfigFile = new System.IO.FileInfo(host.Storage.GetFullPath("drawings.ini"));
|
||||||
|
moveFile(drawingsConfigFile, cfgDestination);
|
||||||
|
}
|
||||||
|
|
||||||
if (host.Storage.Exists("drawings_results.txt"))
|
if (host.Storage.Exists("drawings_results.txt"))
|
||||||
{
|
{
|
||||||
Logger.Log("Migrating drawings results to default tournament storage.");
|
Logger.Log("Migrating drawings results to default tournament storage.");
|
||||||
|
@ -55,7 +55,7 @@ namespace osu.Game.Tournament.Screens.Drawings
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
drawingsConfig = new DrawingsConfigManager(storage);
|
drawingsConfig = new DrawingsConfigManager(storage.ConfigurationStorage);
|
||||||
|
|
||||||
InternalChildren = new Drawable[]
|
InternalChildren = new Drawable[]
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user