invert and early return

This commit is contained in:
Shivam 2020-06-24 00:00:21 +02:00
parent 8e8458ab8f
commit 7a3315dcf8

View File

@ -14,7 +14,7 @@ namespace osu.Game.Tournament.IO
private readonly Storage storage; private readonly Storage storage;
internal readonly TournamentVideoResourceStore VideoStore; internal readonly TournamentVideoResourceStore VideoStore;
private const string default_tournament = "default"; private const string default_tournament = "default";
public TournamentStorage(Storage storage) public TournamentStorage(Storage storage)
: base(storage.GetStorageForDirectory("tournaments"), string.Empty) : base(storage.GetStorageForDirectory("tournaments"), string.Empty)
{ {
@ -60,13 +60,13 @@ namespace osu.Game.Tournament.IO
private void moveFileIfExists(string file, DirectoryInfo destination) private void moveFileIfExists(string file, DirectoryInfo destination)
{ {
if (storage.Exists(file)) if (!storage.Exists(file))
{ return;
Logger.Log($"Migrating {file} to default tournament storage.");
var fileInfo = new System.IO.FileInfo(storage.GetFullPath(file)); Logger.Log($"Migrating {file} to default tournament storage.");
AttemptOperation(() => fileInfo.CopyTo(Path.Combine(destination.FullName, fileInfo.Name), true)); var fileInfo = new System.IO.FileInfo(storage.GetFullPath(file));
fileInfo.Delete(); AttemptOperation(() => fileInfo.CopyTo(Path.Combine(destination.FullName, fileInfo.Name), true));
} fileInfo.Delete();
} }
} }
} }