diff --git a/MPF.Library/Data/BaseParameters.cs b/MPF.Library/Data/BaseParameters.cs index e9b1bc9b..a9adc190 100644 --- a/MPF.Library/Data/BaseParameters.cs +++ b/MPF.Library/Data/BaseParameters.cs @@ -164,11 +164,28 @@ namespace MPF.Data /// Drive representing the disc to get information from public abstract void GenerateSubmissionInfo(SubmissionInfo submissionInfo, string basePath, Drive drive); + /// + /// Returns if the related executable exists in the configured path or not + /// + /// True if the executable exists, false otherwise + public bool InternalProgramExists() + { + // Missing path information means we can't invoke anyway + if (string.IsNullOrWhiteSpace(ExecutablePath)) + return false; + + return File.Exists(ExecutablePath); + } + /// /// Run internal program /// public void ExecuteInternalProgram() { + // Invalid path means we shouldn't try to invoke + if (!InternalProgramExists()) + return; + process = new Process() { StartInfo = new ProcessStartInfo() diff --git a/MPF.Library/Utilities/DumpEnvironment.cs b/MPF.Library/Utilities/DumpEnvironment.cs index 87bf82a7..91847421 100644 --- a/MPF.Library/Utilities/DumpEnvironment.cs +++ b/MPF.Library/Utilities/DumpEnvironment.cs @@ -475,6 +475,13 @@ namespace MPF.Utilities if (!result) return result; + // Check that the internal tool exists + if (!Parameters.InternalProgramExists()) + { + progress?.Report(Result.Success($"Could not find executable for {this.InternalProgram}!")); + return Result.Failure($"Could not find executable for {this.InternalProgram}!"); + } + // Execute internal tool progress?.Report(Result.Success($"Executing {this.InternalProgram}... please wait!")); Directory.CreateDirectory(OutputDirectory); diff --git a/MPF/Windows/MainWindow.xaml.cs b/MPF/Windows/MainWindow.xaml.cs index be942235..cdbd3a06 100644 --- a/MPF/Windows/MainWindow.xaml.cs +++ b/MPF/Windows/MainWindow.xaml.cs @@ -646,6 +646,13 @@ namespace MPF.Windows ShowDiscInformationWindow ); } + else + { + ViewModels.LoggerViewModel.VerboseLogLn(result.Message); + StatusLabel.Content = "Execution failed!"; + StartStopButton.Content = Interface.StartDumping; + CopyProtectScanButton.IsEnabled = true; + } } catch {