Merge branch 'fix-nested-folder-migration-endless-copy' into migration-ui

This commit is contained in:
Dean Herbert
2020-05-15 13:04:16 +09:00
13 changed files with 62 additions and 24 deletions

View File

@ -48,10 +48,14 @@ namespace osu.Game.IO
var source = new DirectoryInfo(GetFullPath("."));
var destination = new DirectoryInfo(newLocation);
if (source.FullName == destination.FullName)
// using Uri is the easiest way to check equality and contains (https://stackoverflow.com/a/7710620)
var sourceUri = new Uri(source.FullName + Path.DirectorySeparatorChar);
var destinationUri = new Uri(destination.FullName + Path.DirectorySeparatorChar);
if (sourceUri == destinationUri)
throw new ArgumentException("Destination provided is already the current location", nameof(newLocation));
if (destination.FullName.Contains(source.FullName))
if (sourceUri.IsBaseOf(destinationUri))
throw new ArgumentException("Destination provided is inside the source", nameof(newLocation));
// ensure the new location has no files present, else hard abort