mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
Merge pull request #52 from tr4wzified/properfoldervalidation
Add validation to prevent Wabbajack from crashing when selecting invalid profile directory or starting compilation without specifying profile directory
This commit is contained in:
commit
97c5fbecf8
@ -425,13 +425,15 @@ namespace Wabbajack
|
||||
if (folder != null)
|
||||
{
|
||||
var file = Path.Combine(folder, "modlist.txt");
|
||||
if (!File.Exists(file))
|
||||
if(File.Exists(file))
|
||||
{
|
||||
Location = file;
|
||||
ConfigureForBuild();
|
||||
}
|
||||
else
|
||||
{
|
||||
Utils.Log($"No modlist.txt found at {file}");
|
||||
}
|
||||
|
||||
Location = file;
|
||||
ConfigureForBuild();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -500,32 +502,40 @@ namespace Wabbajack
|
||||
}
|
||||
else
|
||||
{
|
||||
var compiler = new Compiler(_mo2Folder, msg => LogMsg(msg));
|
||||
compiler.IgnoreMissingFiles = IgnoreMissingFiles;
|
||||
compiler.MO2Profile = ModListName;
|
||||
var th = new Thread(() =>
|
||||
if (_mo2Folder != null)
|
||||
{
|
||||
UIReady = false;
|
||||
try
|
||||
var compiler = new Compiler(_mo2Folder, msg => LogMsg(msg));
|
||||
compiler.IgnoreMissingFiles = IgnoreMissingFiles;
|
||||
compiler.MO2Profile = ModListName;
|
||||
var th = new Thread(() =>
|
||||
{
|
||||
compiler.Compile();
|
||||
if (compiler.ModList != null && compiler.ModList.ReportHTML != null)
|
||||
HTMLReport = compiler.ModList.ReportHTML;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
while (ex.InnerException != null) ex = ex.InnerException;
|
||||
LogMsg(ex.StackTrace);
|
||||
LogMsg(ex.ToString());
|
||||
LogMsg($"{ex.Message} - Can't continue");
|
||||
}
|
||||
finally
|
||||
{
|
||||
UIReady = true;
|
||||
}
|
||||
});
|
||||
th.Priority = ThreadPriority.BelowNormal;
|
||||
th.Start();
|
||||
UIReady = false;
|
||||
try
|
||||
{
|
||||
compiler.Compile();
|
||||
if (compiler.ModList != null && compiler.ModList.ReportHTML != null)
|
||||
HTMLReport = compiler.ModList.ReportHTML;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
while (ex.InnerException != null) ex = ex.InnerException;
|
||||
LogMsg(ex.StackTrace);
|
||||
LogMsg(ex.ToString());
|
||||
LogMsg($"{ex.Message} - Can't continue");
|
||||
}
|
||||
finally
|
||||
{
|
||||
UIReady = true;
|
||||
}
|
||||
});
|
||||
th.Priority = ThreadPriority.BelowNormal;
|
||||
th.Start();
|
||||
}
|
||||
else
|
||||
{
|
||||
Utils.Log("Cannot compile modlist: no valid Mod Organizer profile directory selected.");
|
||||
UIReady = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user