Save path fixing until the very end (fixes #176)

This commit is contained in:
Matt Nadareski
2020-01-26 22:24:10 -08:00
parent 12b43cf688
commit 9871eb9928
2 changed files with 7 additions and 8 deletions

View File

@@ -242,7 +242,8 @@ namespace DICUI.Utilities
try
{
// Cache if we had a directory separator or not
bool endedWithDirectorySeparator = OutputDirectory.EndsWith(Path.DirectorySeparatorChar.ToString());
bool endedWithDirectorySeparator = OutputDirectory.EndsWith(Path.DirectorySeparatorChar.ToString())
|| OutputDirectory.EndsWith(Path.AltDirectorySeparatorChar.ToString());
bool endedWithSpace = OutputDirectory.EndsWith(" ");
// Combine the path to make things separate easier
@@ -372,10 +373,9 @@ namespace DICUI.Utilities
if (Drive == null)
return null;
FixOutputPaths();
// Set the proper parameters
DICParameters = new Parameters(System, Type, Drive.Letter, Path.Combine(OutputDirectory, OutputFilename), driveSpeed, ParanoidMode, RereadAmountC2);
string filename = OutputDirectory + Path.DirectorySeparatorChar + OutputFilename;
DICParameters = new Parameters(System, Type, Drive.Letter, filename, driveSpeed, ParanoidMode, RereadAmountC2);
if (QuietMode)
DICParameters[DICFlag.DisableBeep] = true;

View File

@@ -3,7 +3,6 @@ using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using WinForms = System.Windows.Forms;
@@ -427,9 +426,6 @@ namespace DICUI.Windows
Type = MediaTypeComboBox.SelectedItem as MediaType?,
};
// Fix the output paths
env.FixOutputPaths();
// Disable automatic reprocessing of the textboxes until we're done
OutputDirectoryTextBox.TextChanged -= OutputDirectoryTextBoxTextChanged;
OutputFilenameTextBox.TextChanged -= OutputFilenameTextBoxTextChanged;
@@ -466,6 +462,9 @@ namespace DICUI.Windows
// If "No", then we continue with the current known environment
}
// Fix the output paths
_env.FixOutputPaths();
try
{
// Check for the firmware first