Fix bug where installing modlist would always result in location validation error, Add more validation

This commit is contained in:
trawzified 2019-10-05 17:05:51 +02:00
parent ad661871a5
commit e5d36b3452
3 changed files with 27 additions and 7 deletions

View File

@ -30,10 +30,10 @@ namespace Wabbajack
private bool _ignoreMissingFiles;
private string _location;
private string _locationLabel;
private string _mo2Folder;
private string _mode;
private ModList _modList;
private string _modListName;
@ -64,9 +64,9 @@ namespace Wabbajack
if (Assembly.GetEntryAssembly().Location.ToLower().Contains("\\downloads\\"))
{
MessageBox.Show(
"This app seems to be running inside a folder called `Downloads`, such folders are often highly monitored by antivirus software and they can often " +
"conflict with the operations Wabbajack needs to perform. Please move this executable outside of your `Downloads` folder and then restart the app.",
"Cannot run inside `Downloads`",
"This app seems to be running inside a folder called 'Downloads', such folders are often highly monitored by antivirus software and they can often " +
"conflict with the operations Wabbajack needs to perform. Please move this executable outside of your 'Downloads' folder and then restart the app.",
"Cannot run inside 'Downloads'",
MessageBoxButton.OK,
MessageBoxImage.Error);
Environment.Exit(1);
@ -132,6 +132,16 @@ namespace Wabbajack
OnPropertyChanged("Location");
}
}
public string LocationLabel
{
get => _locationLabel;
set
{
_locationLabel = value;
OnPropertyChanged("LocationLabel");
}
}
public string DownloadLocation
@ -320,12 +330,20 @@ namespace Wabbajack
{
validationMessage = null;
}
else if (Location != null && Directory.Exists(Location) && File.Exists(Path.Combine(Location, "modlist.txt")))
else if (Mode == "Building" && Location != null && Directory.Exists(Location) && File.Exists(Path.Combine(Location, "modlist.txt")))
{
Location = Path.Combine(Location, "modlist.txt");
validationMessage = null;
ConfigureForBuild();
}
else if (Mode == "Installing" && Location != null && Directory.Exists(Location) && !Directory.EnumerateFileSystemEntries(Location).Any())
{
validationMessage = null;
}
else if (Mode == "Installing" && Location != null && Directory.Exists(Location) && Directory.EnumerateFileSystemEntries(Location).Any())
{
validationMessage = "You have selected a non-empty directory. Installing the modlist here might result in a broken install!";
}
else
{
validationMessage = "Invalid Mod Organizer profile directory";

View File

@ -64,7 +64,7 @@
<RowDefinition MinHeight="10" />
<RowDefinition />
</Grid.RowDefinitions>
<Label Grid.Row="0" Content="MO2 Profile:" Grid.Column="0" />
<Label Grid.Row="0" Content="{Binding LocationLabel}" Grid.Column="0" />
<TextBox Grid.Row="0" Grid.Column="1" Text="{Binding Location, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True, NotifyOnValidationError=True}" IsEnabled="{Binding UIReady}"/>
<Button Grid.Row="0" Content="Select" MinWidth="80" Grid.Column="2" Command="{Binding ChangePath}" IsEnabled="{Binding UIReady}"/>
<Label Grid.Row="2" Content="Download Location:" Grid.Column="0" />

View File

@ -42,7 +42,7 @@ namespace Wabbajack
Utils.SetStatusFn((msg, progress) => WorkQueue.Report(msg, progress));
UIUtils.Dispatcher = Dispatcher;
_state._nexusSiteURL = "https://github.com/halgari/wabbajack";
_state._nexusSiteURL = "https://github.com/wabbajack-tools/wabbajack";
new Thread(() =>
{
@ -50,10 +50,12 @@ namespace Wabbajack
{
Utils.Log("Compiler ready to execute");
context.Location = Path.GetDirectoryName(source);
context.LocationLabel = "MO2 Profile:";
}
else if (mode == RunMode.Install)
{
context.UIReady = false;
context.LocationLabel = "Installation Location:";
var modlist = Installer.LoadFromFile(source);
if (modlist == null)
{