diff --git a/CHANGELIST.md b/CHANGELIST.md index fa1b47c8..1fce2948 100644 --- a/CHANGELIST.md +++ b/CHANGELIST.md @@ -80,6 +80,7 @@ - Ensure drive is not null for volume labels - Check explicitly for no matches on Redump pull - Normalize PS1/PS2 executable names +- Adjust paths for DIC just before dumping ### 2.2 (2021-12-30) - Fix Saturn header finding diff --git a/MPF.Library/DumpEnvironment.cs b/MPF.Library/DumpEnvironment.cs index cd852858..76664333 100644 --- a/MPF.Library/DumpEnvironment.cs +++ b/MPF.Library/DumpEnvironment.cs @@ -118,6 +118,28 @@ namespace MPF.Library #region Public Functionality + /// + /// Adjust output paths if we're using DiscImageCreator + /// + public void AdjustPathsForDiscImageCreator() + { + // Only DiscImageCreator has issues with paths + if (this.Parameters.InternalProgram != InternalProgram.DiscImageCreator) + return; + + // Replace all instances in the output directory + this.OutputDirectory = this.OutputDirectory.Replace('.', '_'); + + // Currently, only periods in directories matter + // Leave the following code commented in case filename handling breaks again + + // Replace all instances in the output filename, except the extension + //string tempFilename = Path.GetFileNameWithoutExtension(this.OutputFilename) + // .Replace('.', '_'); + //string tempExtension = Path.GetExtension(this.OutputFilename)?.TrimStart('.'); + //this.OutputFilename = $"{tempFilename}.{tempExtension}"; + } + /// /// Set the parameters object based on the internal program and parameters string /// diff --git a/MPF.Library/InfoTool.cs b/MPF.Library/InfoTool.cs index 4a47f4d4..8c1b2a9b 100644 --- a/MPF.Library/InfoTool.cs +++ b/MPF.Library/InfoTool.cs @@ -1089,7 +1089,8 @@ namespace MPF.Library // Take care of extra path characters directory = new StringBuilder(directory) - .Replace(':', '_', 0, directory.LastIndexOf(':') == -1 ? 0 : directory.LastIndexOf(':')).ToString(); + .Replace(':', '_', 0, directory.LastIndexOf(':') == -1 ? 0 : directory.LastIndexOf(':')) + .ToString(); // Sanitize everything else foreach (char c in Path.GetInvalidPathChars()) diff --git a/MPF/ViewModels/MainViewModel.cs b/MPF/ViewModels/MainViewModel.cs index e7df339f..5b6b152f 100644 --- a/MPF/ViewModels/MainViewModel.cs +++ b/MPF/ViewModels/MainViewModel.cs @@ -1202,6 +1202,9 @@ namespace MPF.GUI.ViewModels // One last check to determine environment, just in case Env = DetermineEnvironment(); + // Run path adjustments for DiscImageCreator + Env.AdjustPathsForDiscImageCreator(); + // If still in custom parameter mode, check that users meant to continue or not if (App.Instance.EnableParametersCheckBox.IsChecked == true) {