diff --git a/CHANGELOG.md b/CHANGELOG.md index 7b3601c0..f7493697 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ * Slideshow timer resets when next is pressed * Changed modlist extension to `.wabbajack` * You can now open modlists directly (after initial launch) +* Wabbajack will exit if MO2 is running #### Version 1.0 alpha 2 - 10/15/2019 * Fix installer running in wrong mode diff --git a/Wabbajack.Common/Utils.cs b/Wabbajack.Common/Utils.cs index 4928b117..3c8a448c 100644 --- a/Wabbajack.Common/Utils.cs +++ b/Wabbajack.Common/Utils.cs @@ -26,6 +26,12 @@ namespace Wabbajack.Common { public static class Utils { + public static bool IsMO2Running(string mo2Path) + { + Process[] processList = Process.GetProcesses(); + return processList.Where(process => process.ProcessName == "ModOrganizer").Any(process => Path.GetDirectoryName(process.MainModule?.FileName) == mo2Path); + } + public static string LogFile { get; private set; } static Utils() { diff --git a/Wabbajack/AppState.cs b/Wabbajack/AppState.cs index 9eea5bb0..ff590923 100644 --- a/Wabbajack/AppState.cs +++ b/Wabbajack/AppState.cs @@ -280,6 +280,13 @@ namespace Wabbajack this.ModListName = profile_name; this.Mode = RunMode.Compile; + if (Utils.IsMO2Running(mo2folder)) + { + MessageBox.Show("You need to close MO2 before running Wabbajack!", + "Error", MessageBoxButton.OK); + Environment.Exit(1); + } + var tmp_compiler = new Compiler(mo2folder); DownloadLocation = tmp_compiler.MO2DownloadsFolder;