mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 05:32:54 +08:00
Merge pull request #22467 from Cootz/issue#22345
Fix migration putting game files in root of disk if no other files exist
This commit is contained in:
commit
7d1b5751fd
@ -47,7 +47,7 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance
|
||||
var directoryInfos = target.GetDirectories();
|
||||
var fileInfos = target.GetFiles();
|
||||
|
||||
if (directoryInfos.Length > 0 || fileInfos.Length > 0)
|
||||
if (directoryInfos.Length > 0 || fileInfos.Length > 0 || target.Parent == null)
|
||||
{
|
||||
// Quick test for whether there's already an osu! install at the target path.
|
||||
if (fileInfos.Any(f => f.Name == OsuGameBase.CLIENT_DATABASE_FILENAME))
|
||||
@ -65,7 +65,9 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance
|
||||
return;
|
||||
}
|
||||
|
||||
target = target.CreateSubdirectory("osu-lazer");
|
||||
// Not using CreateSubDirectory as it throws unexpectedly when attempting to create a directory when already at the root of a disk.
|
||||
// See https://cs.github.com/dotnet/runtime/blob/f1bdd5a6182f43f3928b389b03f7bc26f826c8bc/src/libraries/System.Private.CoreLib/src/System/IO/DirectoryInfo.cs#L88-L94
|
||||
target = Directory.CreateDirectory(Path.Combine(target.FullName, @"osu-lazer"));
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
|
Loading…
Reference in New Issue
Block a user