mirror of
https://github.com/osukey/osukey.git
synced 2025-08-08 09:03:50 +09:00
Throw better exceptions from OsuStorage
This commit is contained in:
@ -48,11 +48,14 @@ namespace osu.Game.IO
|
|||||||
var source = new DirectoryInfo(GetFullPath("."));
|
var source = new DirectoryInfo(GetFullPath("."));
|
||||||
var destination = new DirectoryInfo(newLocation);
|
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
|
// ensure the new location has no files present, else hard abort
|
||||||
if (destination.Exists)
|
if (destination.Exists)
|
||||||
{
|
{
|
||||||
if (destination.GetFiles().Length > 0 || destination.GetDirectories().Length > 0)
|
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);
|
deleteRecursive(destination);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user