diff --git a/SabreTools.Helper/Dats/DatFile.cs b/SabreTools.Helper/Dats/DatFile.cs index bf02696a..9f70ba6e 100644 --- a/SabreTools.Helper/Dats/DatFile.cs +++ b/SabreTools.Helper/Dats/DatFile.cs @@ -4494,7 +4494,7 @@ namespace SabreTools.Helper.Dats { string infile = pathsToFiles[i]; Rom outrom = romsInGame[i]; - string outfile = Path.Combine(outDir, outrom.Machine.Name, outrom.Name); + string outfile = Path.Combine(outDir, Style.RemovePathUnsafeCharacters(outrom.Machine.Name), outrom.Name); // Make sure the output folder is created Directory.CreateDirectory(Path.GetDirectoryName(outfile)); @@ -4517,6 +4517,7 @@ namespace SabreTools.Helper.Dats { string infile = pathsToFiles[i]; Rom outrom = romsInGame[i]; + outrom.Machine.Name = Style.RemovePathUnsafeCharacters(outrom.Machine.Name); ArchiveTools.WriteTorrentGZ(infile, outDir, romba, logger); } break; diff --git a/SabreTools.Helper/Tools/ArchiveTools.cs b/SabreTools.Helper/Tools/ArchiveTools.cs index 8a33a75a..ee9b5745 100644 --- a/SabreTools.Helper/Tools/ArchiveTools.cs +++ b/SabreTools.Helper/Tools/ArchiveTools.cs @@ -898,7 +898,7 @@ namespace SabreTools.Helper.Tools } // Get the output archive name from the first rebuild rom - string archiveFileName = Path.Combine(outDir, roms[0].Machine.Name + (roms[0].Machine.Name.EndsWith(".tar") ? "" : ".tar")); + string archiveFileName = Path.Combine(outDir, Style.RemovePathUnsafeCharacters(roms[0].Machine.Name) + (roms[0].Machine.Name.EndsWith(".tar") ? "" : ".tar")); // Set internal variables Stream tarstream = new MemoryStream(); @@ -1224,7 +1224,7 @@ namespace SabreTools.Helper.Tools } // Get the output archive name from the first rebuild rom - string archiveFileName = Path.Combine(outDir, roms[0].Machine.Name + (roms[0].Machine.Name.EndsWith(".zip") ? "" : ".zip")); + string archiveFileName = Path.Combine(outDir, Style.RemovePathUnsafeCharacters(roms[0].Machine.Name) + (roms[0].Machine.Name.EndsWith(".zip") ? "" : ".zip")); // Set internal variables Stream writeStream = null;