Adjust paths for DIC just before dumping (fixes #358)

This commit is contained in:
Matt Nadareski
2022-02-04 20:46:56 -08:00
parent c8a4a61028
commit 45f79d95b1
4 changed files with 28 additions and 1 deletions

View File

@@ -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

View File

@@ -118,6 +118,28 @@ namespace MPF.Library
#region Public Functionality
/// <summary>
/// Adjust output paths if we're using DiscImageCreator
/// </summary>
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}";
}
/// <summary>
/// Set the parameters object based on the internal program and parameters string
/// </summary>

View File

@@ -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())

View File

@@ -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)
{