make migrate public abstract in base and override

This commit is contained in:
Shivam
2020-06-23 23:58:28 +02:00
parent 8b9cf6fc52
commit 8e8458ab8f
3 changed files with 8 additions and 6 deletions

View File

@ -14,7 +14,7 @@ namespace osu.Game.Tournament.IO
private readonly Storage storage;
internal readonly TournamentVideoResourceStore VideoStore;
private const string default_tournament = "default";
public TournamentStorage(Storage storage)
: base(storage.GetStorageForDirectory("tournaments"), string.Empty)
{
@ -30,7 +30,7 @@ namespace osu.Game.Tournament.IO
}
else
{
migrate();
Migrate(GetFullPath(default_tournament));
storageConfig.Set(StorageConfig.CurrentTournament, default_tournament);
storageConfig.Save();
ChangeTargetStorage(UnderlyingStorage.GetStorageForDirectory(default_tournament));
@ -40,10 +40,10 @@ namespace osu.Game.Tournament.IO
Logger.Log("Using tournament storage: " + GetFullPath(string.Empty));
}
private void migrate()
override public void Migrate(string newLocation)
{
var source = new DirectoryInfo(storage.GetFullPath("tournament"));
var destination = new DirectoryInfo(GetFullPath(default_tournament));
var destination = new DirectoryInfo(newLocation);
if (source.Exists)
{

View File

@ -16,12 +16,14 @@ namespace osu.Game.IO
{
internal virtual string[] IGNORE_DIRECTORIES { get; }
internal virtual string[] IGNORE_FILES { get; }
protected MigratableStorage(Storage storage, string subPath = null)
: base(storage, subPath)
{
}
abstract public void Migrate(string newLocation);
protected void DeleteRecursive(DirectoryInfo target, bool topLevelExcludes = true)
{
foreach (System.IO.FileInfo fi in target.GetFiles())

View File

@ -53,7 +53,7 @@ namespace osu.Game.IO
Logger.Storage = UnderlyingStorage.GetStorageForDirectory("logs");
}
public void Migrate(string newLocation)
override public void Migrate(string newLocation)
{
var source = new DirectoryInfo(GetFullPath("."));
var destination = new DirectoryInfo(newLocation);