Don't assume paths are in the correct format

This commit is contained in:
Matt Nadareski
2024-07-15 13:42:49 -04:00
parent 25efd3b7a2
commit c42304adf1

View File

@@ -361,6 +361,12 @@ namespace SabreTools.FileTypes
fileName = Path.Combine(outDir, TextHelper.RemovePathUnsafeCharacters(baseFile.Parent) ?? string.Empty, TextHelper.RemovePathUnsafeCharacters(baseFile.Filename) ?? string.Empty); fileName = Path.Combine(outDir, TextHelper.RemovePathUnsafeCharacters(baseFile.Parent) ?? string.Empty, TextHelper.RemovePathUnsafeCharacters(baseFile.Filename) ?? string.Empty);
#endif #endif
// Replace any incorrect directory characters
if (Path.DirectorySeparatorChar == '\\')
fileName = fileName.Replace('/', '\\');
else if (Path.DirectorySeparatorChar == '/')
fileName = fileName.Replace('\\', '/');
try try
{ {
// If the full output path doesn't exist, create it // If the full output path doesn't exist, create it