Skip to content

Commit 73c3e45

Browse files
Fix Restore Mod Backup failing
1 parent 4ca0ee0 commit 73c3e45

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

xivModdingFramework/Helpers/IOUtil.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -744,6 +744,11 @@ public static void CopyFolder(string sourcePath, string targetPath)
744744
sourcePath = MakeLongPath(sourcePath);
745745
targetPath = MakeLongPath(targetPath);
746746

747+
// \\?\ prefixed Long File Names will fail if there's double slashes in a path
748+
// Guarantee the source and target both have trailing slashes to avoid accidentally creating a double slash
749+
if (!sourcePath.EndsWith("\\")) sourcePath += "\\";
750+
if (!targetPath.EndsWith("\\")) targetPath += "\\";
751+
747752
Directory.CreateDirectory(targetPath);
748753

749754
//Now Create all of the directories
@@ -765,6 +770,8 @@ public static string MakeLongPath(string path)
765770
{
766771
if (!path.StartsWith("\\\\?\\"))
767772
{
773+
while (path.Contains("\\\\"))
774+
path = path.Replace("\\\\", "\\");
768775
path = "\\\\?\\" + path;
769776
}
770777
return path.Replace("/", "\\");

0 commit comments

Comments
 (0)