mirror of
https://github.com/ppy/osu.git
synced 2025-01-13 09:23:06 +08:00
Use DirectoryInfo in more places
This commit is contained in:
parent
0bbf02d916
commit
bbebd26efb
@ -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));
|
||||||
|
Loading…
Reference in New Issue
Block a user