1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-13 11:23:00 +08:00

Use DirectoryInfo in more places

This commit is contained in:
Dean Herbert 2020-05-09 20:13:31 +09:00
parent 0bbf02d916
commit bbebd26efb

View File

@ -41,20 +41,18 @@ namespace osu.Game.IO
public void Migrate(string newLocation) public void Migrate(string newLocation)
{ {
string oldLocation = GetFullPath("."); var source = new DirectoryInfo(GetFullPath("."));
var destination = new DirectoryInfo(newLocation);
// ensure the new location has no files present, else hard abort // ensure the new location has no files present, else hard abort
if (Directory.Exists(newLocation)) if (destination.Exists)
{ {
if (Directory.GetFiles(newLocation).Length > 0) if (destination.GetFiles().Length > 0)
throw new InvalidOperationException("Migration destination already has files present"); throw new InvalidOperationException("Migration destination already has files present");
Directory.Delete(newLocation, true); deleteRecursive(destination);
} }
var source = new DirectoryInfo(oldLocation);
var destination = new DirectoryInfo(newLocation);
copyRecursive(source, destination); copyRecursive(source, destination);
ChangeTargetStorage(host.GetStorage(newLocation)); ChangeTargetStorage(host.GetStorage(newLocation));