1
0
mirror of https://github.com/ppy/osu.git synced 2026-05-29 07:29:53 +08:00

Throw better exceptions from OsuStorage

This commit is contained in:
Dean Herbert
2020-05-13 22:57:41 +09:00
Unverified
parent 4b0ca87a0a
commit 25bbb02999
+4 -1
View File
@@ -48,11 +48,14 @@ namespace osu.Game.IO
var source = new DirectoryInfo(GetFullPath("."));
var destination = new DirectoryInfo(newLocation);
if (source.FullName == destination.FullName)
throw new ArgumentException("Destination provided is already the current location", nameof(newLocation));
// ensure the new location has no files present, else hard abort
if (destination.Exists)
{
if (destination.GetFiles().Length > 0 || destination.GetDirectories().Length > 0)
throw new InvalidOperationException("Migration destination already has files present");
throw new ArgumentException("Destination provided already has files or directories present", nameof(newLocation));
deleteRecursive(destination);
}