Merge pull request #1289 from Unnoen/modify-download-path-if-same

Append "/downloads" to download path if the same as install path.
This commit is contained in:
Timothy Baldridge 2021-02-03 20:49:27 -07:00 committed by GitHub
commit 5ee8f2a4c3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -76,18 +76,30 @@ namespace Wabbajack
})
.ToProperty(this, nameof(CanInstall));
// Have Installation location updates modify the downloads location if empty
// Have Installation location updates modify the downloads location if empty or the same path
this.WhenAny(x => x.Location.TargetPath)
.Skip(1) // Don't do it initially
.Subscribe(installPath =>
{
if (DownloadLocation.TargetPath == default)
if (DownloadLocation.TargetPath == default || DownloadLocation.TargetPath == installPath)
{
DownloadLocation.TargetPath = installPath.Combine("downloads");
}
})
.DisposeWith(CompositeDisposable);
// Have Download location updates change if the same as the install path
this.WhenAny(x => x.DownloadLocation.TargetPath)
.Skip(1) // Don't do it initially
.Subscribe(downloadPath =>
{
if (downloadPath == Location.TargetPath)
{
DownloadLocation.TargetPath = Location.TargetPath.Combine("downloads");
}
})
.DisposeWith(CompositeDisposable);
// Load settings
_CurrentSettings = installerVM.WhenAny(x => x.ModListLocation.TargetPath)
.Select(path => path == default ? null : installerVM.MWVM.Settings.Installer.Mo2ModlistSettings.TryCreate(path))