mirror of
https://github.com/SabreTools/MPF.git
synced 2026-07-02 17:24:48 +00:00
Adjust paths for DIC just before dumping (fixes #358)
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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())
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user