diff --git a/Wabbajack.Common/Utils.cs b/Wabbajack.Common/Utils.cs index cab10aa9..63fd6713 100644 --- a/Wabbajack.Common/Utils.cs +++ b/Wabbajack.Common/Utils.cs @@ -39,7 +39,8 @@ namespace Wabbajack.Common 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; } + public static string LogFolder { get; } public enum FileEventType { @@ -57,6 +58,7 @@ namespace Wabbajack.Common Directory.CreateDirectory(Consts.LogsFolder); var programName = Assembly.GetEntryAssembly()?.Location ?? "Wabbajack"; + LogFolder = Path.Combine(Path.GetDirectoryName(programName), Consts.LogsFolder); LogFile = Path.Combine(Consts.LogsFolder, Path.GetFileNameWithoutExtension(programName) + ".current.log"); _startTime = DateTime.Now; diff --git a/Wabbajack/View Models/Compilers/CompilerVM.cs b/Wabbajack/View Models/Compilers/CompilerVM.cs index 96df5a4f..a7bee90f 100644 --- a/Wabbajack/View Models/Compilers/CompilerVM.cs +++ b/Wabbajack/View Models/Compilers/CompilerVM.cs @@ -48,7 +48,7 @@ namespace Wabbajack public ObservableCollectionExtended Log => MWVM.Log; public ReactiveCommand BackCommand { get; } - public ReactiveCommand GoToModlistCommand { get; } + public ReactiveCommand GoToCommand { get; } public ReactiveCommand CloseWhenCompleteCommand { get; } public ReactiveCommand BeginCommand { get; } @@ -226,18 +226,21 @@ namespace Wabbajack MWVM.ShutdownApplication(); }); - GoToModlistCommand = ReactiveCommand.Create( + GoToCommand = ReactiveCommand.Create( canExecute: this.WhenAny(x => x.Completed) .Select(x => x != null), execute: () => { - if (string.IsNullOrWhiteSpace(OutputLocation.TargetPath)) + if (Completed?.Failed ?? false) { - Process.Start("explorer.exe", Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location)); + Process.Start("explorer.exe", Utils.LogFolder); } else { - Process.Start("explorer.exe", OutputLocation.TargetPath); + Process.Start("explorer.exe", + string.IsNullOrWhiteSpace(OutputLocation.TargetPath) + ? Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location) + : OutputLocation.TargetPath); } }); diff --git a/Wabbajack/Views/Compilers/CompilationCompleteView.xaml b/Wabbajack/Views/Compilers/CompilationCompleteView.xaml index b0302a94..4b0aa531 100644 --- a/Wabbajack/Views/Compilers/CompilationCompleteView.xaml +++ b/Wabbajack/Views/Compilers/CompilationCompleteView.xaml @@ -85,7 +85,7 @@ Grid.Row="1" Margin="0,10,0,0" HorizontalAlignment="Center" - Text="Go To Modlist" /> + x:Name="ActionText" /> /// Interaction logic for CompilationCompleteView.xaml /// - public partial class CompilationCompleteView : ReactiveUserControl + public partial class CompilationCompleteView { public CompilationCompleteView() { @@ -34,16 +20,18 @@ namespace Wabbajack .DisposeWith(dispose); this.WhenAny(x => x.ViewModel.Completed) .Select(x => x?.Failed ?? false) - .Select(failed => - { - return $"Compilation {(failed ? "Failed" : "Complete")}"; - }) + .Select(failed => $"Compilation {(failed ? "Failed" : "Complete")}") .BindToStrict(this, x => x.TitleText.Text) .DisposeWith(dispose); + this.WhenAny(x => x.ViewModel.Completed) + .Select(x => x?.Failed ?? false) + .Select(failed => failed ? "Open Logs Folder" : "Go to Modlist") + .BindToStrict(this, x => x.ActionText.Text) + .DisposeWith(dispose); this.WhenAny(x => x.ViewModel.BackCommand) .BindToStrict(this, x => x.BackButton.Command) .DisposeWith(dispose); - this.WhenAny(x => x.ViewModel.GoToModlistCommand) + this.WhenAny(x => x.ViewModel.GoToCommand) .BindToStrict(this, x => x.GoToModlistButton.Command) .DisposeWith(dispose); this.WhenAny(x => x.ViewModel.CloseWhenCompleteCommand)