diff --git a/CHANGELIST.md b/CHANGELIST.md index deb1116a..d22c06cb 100644 --- a/CHANGELIST.md +++ b/CHANGELIST.md @@ -14,6 +14,7 @@ - Update Redumper to build 416 - Fix trimming of header output - Use fake filename for Redumper DAT +- Ensure that the full base path is being used ### 3.2.2 (2024-09-24) diff --git a/MPF.Processors/BaseProcessor.cs b/MPF.Processors/BaseProcessor.cs index 52c484f4..1692162c 100644 --- a/MPF.Processors/BaseProcessor.cs +++ b/MPF.Processors/BaseProcessor.cs @@ -320,11 +320,10 @@ namespace MPF.Processors private (bool, List) CheckRequiredFiles(string basePath) { // Get the base filename and directory from the base path - string baseFilename = Path.GetFileName(basePath); string baseDirectory = Path.GetDirectoryName(basePath) ?? string.Empty; // Get the list of output files - var outputFiles = GetOutputFiles(baseFilename); + var outputFiles = GetOutputFiles(basePath); if (outputFiles.Count == 0) return (false, ["Media and system combination not supported"]); @@ -408,12 +407,8 @@ namespace MPF.Processors /// List of all deleteable file paths, empty otherwise private List GetDeleteableFilePaths(string basePath) { - // Get the base filename and directory from the base path - string baseFilename = Path.GetFileName(basePath); - string baseDirectory = Path.GetDirectoryName(basePath) ?? string.Empty; - // Get the list of deleteable files - var deleteableFilenames = GetDeleteableFilenames(baseFilename); + var deleteableFilenames = GetDeleteableFilenames(basePath); if (deleteableFilenames.Count == 0) return []; @@ -422,11 +417,10 @@ namespace MPF.Processors foreach (var filename in deleteableFilenames) { // Skip non-existent files - string outputFilePath = Path.Combine(baseDirectory, filename); - if (!File.Exists(outputFilePath)) + if (!File.Exists(filename)) continue; - deleteableFiles.Add(outputFilePath); + deleteableFiles.Add(filename); } return deleteableFiles; @@ -498,9 +492,9 @@ namespace MPF.Processors if (outputFiles.Count == 0) return []; - // Filter down to deleteable files - var deleteableFiles = outputFiles.Where(of => of.IsZippable); - return deleteableFiles.SelectMany(of => of.Filenames).ToList(); + // Filter down to zippable files + var zippableFiles = outputFiles.Where(of => of.IsZippable); + return zippableFiles.SelectMany(of => of.Filenames).ToList(); } /// @@ -510,12 +504,8 @@ namespace MPF.Processors /// List of all zippable file paths, empty otherwise private List GetZippableFilePaths(string basePath) { - // Get the base filename and directory from the base path - string baseFilename = Path.GetFileName(basePath); - string baseDirectory = Path.GetDirectoryName(basePath) ?? string.Empty; - // Get the list of zippable files - var zippableFilenames = GetZippableFilenames(baseFilename); + var zippableFilenames = GetZippableFilenames(basePath); if (zippableFilenames.Count == 0) return []; @@ -524,11 +514,10 @@ namespace MPF.Processors foreach (var filename in zippableFilenames) { // Skip non-existent files - string outputFilePath = Path.Combine(baseDirectory, filename); - if (!File.Exists(outputFilePath)) + if (!File.Exists(filename)) continue; - zippableFiles.Add(outputFilePath); + zippableFiles.Add(filename); } return zippableFiles; diff --git a/MPF.Processors/Redumper.cs b/MPF.Processors/Redumper.cs index 4df8a711..366c31ae 100644 --- a/MPF.Processors/Redumper.cs +++ b/MPF.Processors/Redumper.cs @@ -410,6 +410,9 @@ namespace MPF.Processors var cueSheet = SabreTools.Serialization.Deserializers.CueSheet.DeserializeFile($"{baseFilename}.cue"); if (cueSheet?.Files != null) { + // Get the base directory to ensure we get the full track path + string baseDirectory = Path.GetDirectoryName(baseFilename) ?? string.Empty; + int trackId = 1; foreach (CueFile? file in cueSheet.Files) { @@ -417,10 +420,10 @@ namespace MPF.Processors if (trackName == null) continue; - cdrom.Add(new($"{trackName}.hash", OutputFileFlags.Binary + cdrom.Add(new(Path.Combine(baseDirectory, $"{trackName}.hash"), OutputFileFlags.Binary | OutputFileFlags.Zippable, $"hash_{trackId}")); - cdrom.Add(new($"{trackName}.skeleton", OutputFileFlags.Binary + cdrom.Add(new(Path.Combine(baseDirectory, $"{trackName}.skeleton"), OutputFileFlags.Binary | OutputFileFlags.Zippable, $"skeleton_{trackId}")); trackId++;