Root directories are weird (Fixes #163)

This commit is contained in:
Matt Nadareski
2019-09-29 21:28:20 -07:00
parent d431a4c87f
commit 755f1b8e95

View File

@@ -273,6 +273,16 @@ namespace DICUI.Utilities
// If we had a directory separator at the end before, add it again
if (endedWithDirectorySeparator)
OutputDirectory += Path.DirectorySeparatorChar;
// If we have a root directory, sanitize
if (Directory.Exists(OutputDirectory))
{
var possibleRootDir = new DirectoryInfo(OutputDirectory);
if (possibleRootDir.Parent == null)
{
OutputDirectory = OutputDirectory.Replace($"{Path.DirectorySeparatorChar}{Path.DirectorySeparatorChar}", $"{Path.DirectorySeparatorChar}");
}
}
}
catch
{