mirror of
https://github.com/SabreTools/MPF.git
synced 2026-07-02 17:24:48 +00:00
Fix trailing space handling for output directory
This commit is contained in:
@@ -246,6 +246,7 @@ namespace DICUI.Utilities
|
||||
{
|
||||
// Cache if we had a directory separator or not
|
||||
bool endedWithDirectorySeparator = OutputDirectory.EndsWith(Path.DirectorySeparatorChar.ToString());
|
||||
bool endedWithSpace = OutputDirectory.TrimEnd(Path.DirectorySeparatorChar).EndsWith(" ");
|
||||
|
||||
// Normalize the path so the below filters work better
|
||||
string combinedPath = Path.Combine(OutputDirectory, OutputFilename);
|
||||
@@ -268,6 +269,10 @@ namespace DICUI.Utilities
|
||||
foreach (char c in Path.GetInvalidFileNameChars())
|
||||
OutputFilename = OutputFilename.Replace(c, '_');
|
||||
|
||||
// If we had a space at the end before, add it again
|
||||
if (endedWithSpace)
|
||||
OutputDirectory += " ";
|
||||
|
||||
// If we had a directory separator at the end before, add it again
|
||||
if (endedWithDirectorySeparator)
|
||||
OutputDirectory += Path.DirectorySeparatorChar;
|
||||
|
||||
Reference in New Issue
Block a user