Merge pull request #133 from erri120/detect-mo2

WJ will close if MO2 is running
This commit is contained in:
Timothy Baldridge 2019-11-01 05:10:24 -06:00 committed by GitHub
commit ee482b5c69
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 0 deletions

View File

@ -6,6 +6,7 @@
* Slideshow timer resets when next is pressed * Slideshow timer resets when next is pressed
* Changed modlist extension to `.wabbajack` * Changed modlist extension to `.wabbajack`
* You can now open modlists directly (after initial launch) * You can now open modlists directly (after initial launch)
* Wabbajack will exit if MO2 is running
#### Version 1.0 alpha 2 - 10/15/2019 #### Version 1.0 alpha 2 - 10/15/2019
* Fix installer running in wrong mode * Fix installer running in wrong mode

View File

@ -26,6 +26,12 @@ namespace Wabbajack.Common
{ {
public static class Utils 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; } public static string LogFile { get; private set; }
static Utils() static Utils()
{ {

View File

@ -280,6 +280,13 @@ namespace Wabbajack
this.ModListName = profile_name; this.ModListName = profile_name;
this.Mode = RunMode.Compile; 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); var tmp_compiler = new Compiler(mo2folder);
DownloadLocation = tmp_compiler.MO2DownloadsFolder; DownloadLocation = tmp_compiler.MO2DownloadsFolder;