Skip to content

Commit ea84222

Browse files
authored
Merge pull request #2730 from wabbajack-tools/4.0-hotfixes
4.0.0.2 hotfixes
2 parents 8234ac4 + a43265c commit ea84222

File tree

6 files changed

+49
-48
lines changed

6 files changed

+49
-48
lines changed

CHANGELOG.md

+8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
### Changelog
22

3+
#### Version - 4.0.0.2 - 3/19/2025
4+
* Fixed an issue where previous installation paths might not be remembered correctly
5+
* From this version onwards, Wabbajack will additionally remember previous installations by .wabbajack filename instead of only by the full install path being the same
6+
* Replaced Play button after installation completes with Open Install Folder
7+
* Added 'Create Desktop Shortcut' button after installation completes
8+
* 'Open File Explorer' after a failed installation has been renamed to 'Open Logs Folder' as it better describes what the button does
9+
* Octopus.Octodiff NuGet library has been updated from 2.0.547 to 2.0.548
10+
311
#### Version - 4.0.0.1 - 3/18/2025
412
* Fixed an issue where manual downloads would get stuck after only a few browser pop-ups
513
* Fixed the new Wabbajack reset working not working in some cases

Wabbajack.App.Wpf/ViewModels/Installers/InstallationVM.cs

+35-37
Original file line numberDiff line numberDiff line change
@@ -117,15 +117,11 @@ public InstallResult? InstallResult
117117

118118
public LogStream LoggerProvider { get; }
119119

120-
private AbsolutePath LastInstallPath { get; set; }
121-
122-
[Reactive] public bool OverwriteFiles { get; set; }
123120

124121
[Reactive] public string HashingSpeed { get; set; }
125122
[Reactive] public string ExtractingSpeed { get; set; }
126123
[Reactive] public string DownloadingSpeed { get; set; }
127124

128-
129125
// Command properties
130126
public ICommand OpenManifestCommand { get; }
131127
public ICommand OpenReadmeCommand { get; }
@@ -140,11 +136,11 @@ public InstallResult? InstallResult
140136
public ICommand CancelCommand { get; }
141137
public ICommand EditInstallDetailsCommand { get; }
142138
public ICommand VerifyCommand { get; }
143-
public ICommand PlayCommand { get; }
139+
public ICommand CreateShortcutCommand { get; }
144140

145141
public InstallationVM(ILogger<InstallationVM> logger, DTOSerializer dtos, SettingsManager settingsManager, IServiceProvider serviceProvider,
146142
SystemParametersConstructor parametersConstructor, IGameLocator gameLocator, LogStream loggerProvider, ResourceMonitor resourceMonitor,
147-
Wabbajack.Services.OSIntegrated.Configuration configuration, HttpClient client, DownloadDispatcher dispatcher, IEnumerable<INeedsLogin> logins)
143+
Services.OSIntegrated.Configuration configuration, HttpClient client, DownloadDispatcher dispatcher, IEnumerable<INeedsLogin> logins)
148144
{
149145
_logger = logger;
150146
_configuration = configuration;
@@ -226,14 +222,7 @@ public InstallationVM(ILogger<InstallationVM> logger, DTOSerializer dtos, Settin
226222

227223
BackToGalleryCommand = ReactiveCommand.Create(() => NavigateToGlobal.Send(ScreenType.ModListGallery));
228224

229-
PlayCommand = ReactiveCommand.Create(() =>
230-
{
231-
Process.Start(new ProcessStartInfo(Installer.Location.TargetPath.Combine("ModOrganizer.exe").ToString()) { UseShellExecute = true });
232-
}, this.WhenAnyValue(vm => vm.LoadingLock.IsNotLoading, vm => vm.InstallState,
233-
(isNotLoading, installState) => isNotLoading && installState == InstallState.Success));
234-
235-
this.WhenAnyValue(x => x.OverwriteFiles)
236-
.Subscribe(x => ConfirmOverwrite());
225+
CreateShortcutCommand = ReactiveCommand.Create(() => CreateDesktopShortcut());
237226

238227
MessageBus.Current.Listen<LoadModlistForInstalling>()
239228
.Subscribe(msg => LoadModlistFromGallery(msg.Path, msg.Metadata).FireAndForget())
@@ -326,6 +315,20 @@ public InstallationVM(ILogger<InstallationVM> logger, DTOSerializer dtos, Settin
326315

327316
}
328317

318+
private void CreateDesktopShortcut()
319+
{
320+
string deskDir = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
321+
322+
using StreamWriter writer = new StreamWriter(deskDir + "\\" + ModList.Name + ".url");
323+
324+
string path = Installer.Location.TargetPath.Combine("ModOrganizer.exe").ToString();
325+
writer.WriteLine("[InternetShortcut]");
326+
writer.WriteLine("URL=file:///" + path);
327+
writer.WriteLine("IconIndex=0");
328+
string icon = path.Replace('\\', '/');
329+
writer.WriteLine("IconFile=" + icon);
330+
}
331+
329332
private static string GetSuggestedInstallFolder(ModlistMetadata x)
330333
{
331334
var folderName = x.Title;
@@ -421,16 +424,9 @@ private IEnumerable<ErrorResponse> Validate()
421424
yield return ErrorResponse.Fail("Installing in this folder may overwrite Wabbajack");
422425
}
423426

424-
if (installPath.ToString().Length != 0 && installPath != LastInstallPath && !OverwriteFiles && installPath.DirectoryExists() &&
425-
Directory.EnumerateFileSystemEntries(installPath.ToString()).Any())
426-
{
427-
yield return ErrorResponse.Fail("There are files in the install folder, please tick 'Overwrite Installation' to confirm you want to install to this folder " + Environment.NewLine +
428-
"if you are updating an existing modlist, then this is expected and can be overwritten.");
429-
}
430-
431427
if (KnownFolders.IsInSpecialFolder(installPath) || KnownFolders.IsInSpecialFolder(downloadPath))
432428
{
433-
yield return ErrorResponse.Fail("Can't install into Windows locations such as Documents etc, please make a new folder for the modlist - C:\\ModList\\ for example.");
429+
yield return ErrorResponse.Fail($"Can't install into Windows locations such as Documents etc, please make a new folder for the modlist - {DriveHelper.GetPreferredInstallationDrive(0).Name}Modlists\\ for example.");
434430
}
435431
// Disabled Because it was causing issues for people trying to update lists.
436432
//if (installPath.ToString().Length > 0 && downloadPath.ToString().Length > 0 && !HasEnoughSpace(installPath, downloadPath)){
@@ -509,8 +505,17 @@ private async Task LoadModlist(AbsolutePath path, ModlistMetadata? metadata)
509505
ConfigurationText = $"Preparing to install {metadata?.Title ?? ModList.Name}";
510506
ProgressText = $"Installation";
511507

512-
var hex = (await WabbajackFileLocation.TargetPath.ToString().Hash()).ToHex();
508+
var hex = (await WabbajackFileLocation.TargetPath.FileName.ToString().Hash()).ToHex();
513509
var prevSettings = await _settingsManager.Load<SavedInstallSettings>(InstallSettingsPrefix + hex);
510+
bool hasPrevModListInstallation = !string.IsNullOrEmpty(prevSettings?.ModListLocation.ToString()) && prevSettings.ModListLocation.FileName == path.FileName;
511+
512+
if(!hasPrevModListInstallation)
513+
{
514+
// Wabbajack combined this with path before 4.0, now only file name is considered
515+
hex = (await WabbajackFileLocation.TargetPath.ToString().Hash()).ToHex();
516+
prevSettings = await _settingsManager.Load<SavedInstallSettings>(InstallSettingsPrefix + hex);
517+
hasPrevModListInstallation = !string.IsNullOrEmpty(prevSettings?.ModListLocation.ToString()) && prevSettings.ModListLocation.FileName == path.FileName;
518+
}
514519

515520
if (path.WithExtension(Ext.MetaData).FileExists())
516521
{
@@ -519,8 +524,11 @@ private async Task LoadModlist(AbsolutePath path, ModlistMetadata? metadata)
519524
metadata = JsonSerializer.Deserialize<ModlistMetadata>(await path.WithExtension(Ext.MetaData)
520525
.ReadAllTextAsync());
521526
ModlistMetadata = metadata;
522-
SuggestedInstallFolder = GetSuggestedInstallFolder(metadata);
523-
SuggestedDownloadFolder = SuggestedInstallFolder + "\\downloads";
527+
if (!hasPrevModListInstallation)
528+
{
529+
SuggestedInstallFolder = GetSuggestedInstallFolder(metadata);
530+
SuggestedDownloadFolder = SuggestedInstallFolder + "\\downloads";
531+
}
524532
}
525533
catch (Exception ex)
526534
{
@@ -532,13 +540,10 @@ private async Task LoadModlist(AbsolutePath path, ModlistMetadata? metadata)
532540
_logger.LogInformation("Modlist metadata not loaded, possibly using local install without metadata file");
533541
}
534542

535-
if (prevSettings.ModListLocation == path)
543+
if (hasPrevModListInstallation)
536544
{
537-
WabbajackFileLocation.TargetPath = prevSettings.ModListLocation;
538-
LastInstallPath = prevSettings.InstallLocation;
539545
Installer.Location.TargetPath = prevSettings.InstallLocation;
540546
Installer.DownloadLocation.TargetPath = prevSettings.DownloadLocation;
541-
ModlistMetadata = metadata ?? prevSettings.Metadata;
542547
}
543548

544549
PopulateSlideShow(ModList);
@@ -554,13 +559,6 @@ private async Task LoadModlist(AbsolutePath path, ModlistMetadata? metadata)
554559
}
555560
}
556561

557-
private void ConfirmOverwrite()
558-
{
559-
AbsolutePath prev = Installer.Location.TargetPath;
560-
Installer.Location.TargetPath = "".ToAbsolutePath();
561-
Installer.Location.TargetPath = prev;
562-
}
563-
564562
private async Task Verify()
565563
{
566564
await Task.Run(async () =>
@@ -606,7 +604,7 @@ await Task.Run(async () =>
606604

607605
await PrepareDownloaders();
608606

609-
var postfix = (await WabbajackFileLocation.TargetPath.ToString().Hash()).ToHex();
607+
var postfix = (await WabbajackFileLocation.TargetPath.FileName.ToString().Hash()).ToHex();
610608
await _settingsManager.Save(InstallSettingsPrefix + postfix, new SavedInstallSettings
611609
{
612610
ModListLocation = WabbajackFileLocation.TargetPath,

Wabbajack.App.Wpf/Views/Installers/InstallationView.xaml

+3-4
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@
232232
The modlist installation has failed because your installation or downloads directory has run out of space.
233233
Please make sure enough space is available on the disk and try again.
234234
</TextBlock>
235-
<local:WJButton x:Name="StoppedButton" Margin="0, 16, 0, 0" HorizontalAlignment="Left" Grid.Row="3" Text="Open File Explorer" Icon="FolderOpen" ButtonStyle="SemiTransparent" />
235+
<local:WJButton x:Name="StoppedButton" Margin="0, 16, 0, 0" HorizontalAlignment="Left" Grid.Row="3" Text="Open Logs Folder" Icon="FolderOpen" ButtonStyle="SemiTransparent" />
236236
</Grid>
237237
</Border>
238238
</Grid>
@@ -291,7 +291,6 @@
291291
<ColumnDefinition Width="Auto" />
292292
<ColumnDefinition Width="Auto" />
293293
</Grid.ColumnDefinitions>
294-
<!-- TODO Fix Cancel button -->
295294
<local:WJButton x:Name="CancelButton" Grid.Column="2" ButtonStyle="Danger" Text="Cancel" Icon="Dismiss" HorizontalAlignment="Right" Visibility="Collapsed" />
296295

297296
<local:WJButton x:Name="EditInstallDetailsButton" Grid.Column="1" ButtonStyle="Mono" Text="Edit Installation Details" Icon="TextBulletListSquareSettings" HorizontalAlignment="Right" Visibility="Visible" Margin="0, 0, 16, 0" />
@@ -319,8 +318,8 @@
319318
</Grid.ColumnDefinitions>
320319
<local:WJButton x:Name="BackToGalleryButton" Grid.Row="1" Text="Back to Gallery" Icon="ChevronLeft" Direction="RightToLeft" HorizontalAlignment="Left" />
321320
<local:WJButton x:Name="ReadmeButton" Grid.Column="2" Text="Open Readme" Icon="WindowNew" HorizontalAlignment="Right" ButtonStyle="Mono" />
322-
<local:WJButton x:Name="OpenFolderButton" Grid.Column="4" Text="Open in File Explorer" Icon="FolderOpen" HorizontalAlignment="Right" ButtonStyle="Mono" />
323-
<local:WJButton x:Name="PlayButton" Grid.Column="6" Text="Play" Icon="PlayCircle" HorizontalAlignment="Right" ButtonStyle="Color" />
321+
<local:WJButton x:Name="CreateShortcutButton" Grid.Column="4" Text="Create Desktop Shortcut" Icon="DesktopArrowRight" HorizontalAlignment="Right" ButtonStyle="Mono" />
322+
<local:WJButton x:Name="OpenFolderButton" Grid.Column="6" Text="Open in File Explorer" Icon="FolderOpen" HorizontalAlignment="Right" ButtonStyle="Color" />
324323
</Grid>
325324
</Grid>
326325
</Grid>

Wabbajack.App.Wpf/Views/Installers/InstallationView.xaml.cs

+2-3
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ public InstallationView()
103103
default:
104104
StoppedButton.Command = ViewModel.OpenInstallFolderCommand;
105105
StoppedButton.Icon = Symbol.FolderOpen;
106-
StoppedButton.Text = "Open File Explorer";
106+
StoppedButton.Text = "Open Logs Folder";
107107
break;
108108
}
109109
})
@@ -262,10 +262,9 @@ public InstallationView()
262262
this.BindCommand(ViewModel, vm => vm.OpenInstallFolderCommand, v => v.OpenFolderButton)
263263
.DisposeWith(disposables);
264264

265-
this.BindCommand(ViewModel, vm => vm.PlayCommand, v => v.PlayButton)
265+
this.BindCommand(ViewModel, vm => vm.CreateShortcutCommand, v => v.CreateShortcutButton)
266266
.DisposeWith(disposables);
267267

268-
269268
// Initially, readme tab should be visible
270269
ReadmeToggleButton.IsChecked = true;
271270

Wabbajack.App.Wpf/Wabbajack.App.Wpf.csproj

-3
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,6 @@
4343
<Reference Update="CefSharp.Wpf">
4444
<Private>true</Private>
4545
</Reference>
46-
<Reference Include="MahApps.Metro.IconPacks.Octicons, Version=4.0.0.0, Culture=neutral, PublicKeyToken=0c0d510f9915137a">
47-
<HintPath>..\..\..\Users\tbald\.nuget\packages\mahapps.metro.iconpacks\4.8.0\lib\netcoreapp3.1\MahApps.Metro.IconPacks.Octicons.dll</HintPath>
48-
</Reference>
4946
</ItemGroup>
5047

5148
<ItemGroup>

Wabbajack.Installer/Wabbajack.Installer.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="9.0.1" />
2828
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="9.0.1" />
2929
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
30-
<PackageReference Include="Octopus.Octodiff" Version="2.0.547" />
30+
<PackageReference Include="Octopus.Octodiff" Version="2.0.548" />
3131
<PackageReference Include="SixLabors.ImageSharp" Version="3.1.6" />
3232
</ItemGroup>
3333

0 commit comments

Comments
 (0)