mirror of
https://github.com/ppy/osu.git
synced 2025-01-26 20:23:00 +08:00
Throw better exceptions from OsuStorage
This commit is contained in:
parent
6bb06e9d61
commit
cb0b25ac55
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user