mirror of
https://github.com/ppy/osu.git
synced 2025-01-12 19:03:08 +08:00
Implement migrations for the drawings config file
This commit is contained in:
parent
32d86d6fab
commit
592e3bf4c9
@ -17,6 +17,7 @@ namespace osu.Game.Tournament.IO
|
||||
internal readonly TournamentVideoResourceStore VideoStore;
|
||||
internal readonly Storage ConfigurationStorage;
|
||||
private const string default_tournament = "default";
|
||||
private const string config_directory = "config";
|
||||
|
||||
public TournamentStorage(GameHost host)
|
||||
: base(host.Storage.GetStorageForDirectory("tournaments"), string.Empty)
|
||||
@ -39,7 +40,7 @@ namespace osu.Game.Tournament.IO
|
||||
ChangeTargetStorage(UnderlyingStorage.GetStorageForDirectory(default_tournament));
|
||||
}
|
||||
|
||||
ConfigurationStorage = UnderlyingStorage.GetStorageForDirectory("config");
|
||||
ConfigurationStorage = UnderlyingStorage.GetStorageForDirectory(config_directory);
|
||||
|
||||
VideoStore = new TournamentVideoResourceStore(this);
|
||||
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 destination = new DirectoryInfo(GetFullPath(default_tournament));
|
||||
var cfgDestination = new DirectoryInfo(GetFullPath(default_tournament + Path.DirectorySeparatorChar + config_directory));
|
||||
|
||||
if (!destination.Exists)
|
||||
destination.Create();
|
||||
|
||||
if (!cfgDestination.Exists)
|
||||
destination.CreateSubdirectory(config_directory);
|
||||
|
||||
if (host.Storage.Exists("bracket.json"))
|
||||
{
|
||||
Logger.Log("Migrating bracket to default tournament storage.");
|
||||
@ -67,6 +72,13 @@ namespace osu.Game.Tournament.IO
|
||||
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"))
|
||||
{
|
||||
Logger.Log("Migrating drawings results to default tournament storage.");
|
||||
|
@ -55,7 +55,7 @@ namespace osu.Game.Tournament.Screens.Drawings
|
||||
return;
|
||||
}
|
||||
|
||||
drawingsConfig = new DrawingsConfigManager(storage);
|
||||
drawingsConfig = new DrawingsConfigManager(storage.ConfigurationStorage);
|
||||
|
||||
InternalChildren = new Drawable[]
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user