public void TestCustomDirectory() { using (HeadlessGameHost host = new TestRunHeadlessGameHost(nameof(TestCustomDirectory), null)) // don't use clean run as we are writing a config file. { string osuDesktopStorage = Path.Combine(host.UserStoragePaths.First(), nameof(TestCustomDirectory)); const string custom_tournament = "custom"; // need access before the game has constructed its own storage yet. Storage storage = new DesktopStorage(osuDesktopStorage, host); // manual cleaning so we can prepare a config file. storage.DeleteDirectory(string.Empty); using (var storageConfig = new TournamentStorageManager(storage)) storageConfig.SetValue(StorageConfig.CurrentTournament, custom_tournament); try { var osu = LoadTournament(host); storage = osu.Dependencies.Get <Storage>(); Assert.That(storage.GetFullPath("."), Is.EqualTo(Path.Combine(host.Storage.GetFullPath("."), "tournaments", custom_tournament))); } finally { host.Exit(); } } }
public TournamentStorage(Storage storage) : base(storage.GetStorageForDirectory("tournaments"), string.Empty) { this.storage = storage; storageConfig = new TournamentStorageManager(storage); if (storage.Exists("tournament.ini")) { ChangeTargetStorage(UnderlyingStorage.GetStorageForDirectory(storageConfig.Get <string>(StorageConfig.CurrentTournament))); } else { Migrate(UnderlyingStorage.GetStorageForDirectory(default_tournament)); } Logger.Log("Using tournament storage: " + GetFullPath(string.Empty)); }