mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
Moved IsMO2Running to Utils.cs, added check for MO2 inside the selected profile folder
This commit is contained in:
parent
108d7dc0d5
commit
fa51cd4d69
@ -26,6 +26,12 @@ namespace Wabbajack.Common
|
||||
{
|
||||
public static class Utils
|
||||
{
|
||||
public static bool IsMO2Running(string mo2Path)
|
||||
{
|
||||
Process[] processList = Process.GetProcesses();
|
||||
return processList.Select(process => (process.ProcessName == "ModOrganizer" && Path.GetDirectoryName(process.MainModule?.FileName) == mo2Path)).FirstOrDefault();
|
||||
}
|
||||
|
||||
public static string LogFile { get; private set; }
|
||||
static Utils()
|
||||
{
|
||||
|
@ -85,15 +85,6 @@ namespace Wabbajack
|
||||
Environment.Exit(1);
|
||||
}
|
||||
|
||||
Process[] processList = Process.GetProcesses();
|
||||
foreach (var process in processList)
|
||||
{
|
||||
if (process.ProcessName != "ModOrganizer") continue;
|
||||
MessageBox.Show("You need to close MO2 before running Wabbajack!",
|
||||
"Error", MessageBoxButton.OK);
|
||||
Environment.Exit(1);
|
||||
}
|
||||
|
||||
Mode = mode;
|
||||
|
||||
// Define commands
|
||||
@ -289,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;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user