From 9871eb9928f2d675bd903136e91edb0fb77355d3 Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Sun, 26 Jan 2020 22:24:10 -0800 Subject: [PATCH] Save path fixing until the very end (fixes #176) --- DICUI.Library/Utilities/DumpEnvironment.cs | 8 ++++---- DICUI/Windows/MainWindow.xaml.cs | 7 +++---- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/DICUI.Library/Utilities/DumpEnvironment.cs b/DICUI.Library/Utilities/DumpEnvironment.cs index 44887ccc..f6010acd 100644 --- a/DICUI.Library/Utilities/DumpEnvironment.cs +++ b/DICUI.Library/Utilities/DumpEnvironment.cs @@ -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; diff --git a/DICUI/Windows/MainWindow.xaml.cs b/DICUI/Windows/MainWindow.xaml.cs index b65ade4d..58a85997 100644 --- a/DICUI/Windows/MainWindow.xaml.cs +++ b/DICUI/Windows/MainWindow.xaml.cs @@ -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