0
0
mirror of https://github.com/sp-tarkov/launcher.git synced 2025-02-12 17:10:44 -05:00

Merge pull request 'bug fixes' (!63) from waffle.lord/Launcher:fix/profile-wipe into master

Reviewed-on: SPT/Launcher#63
This commit is contained in:
IsWaffle 2024-07-12 13:40:31 +00:00
commit c121b7fee7
3 changed files with 16 additions and 14 deletions

View File

@ -18,8 +18,6 @@ namespace SPT.Launcher.ViewModels
[RequireLoggedIn] [RequireLoggedIn]
public class ProfileViewModel : ViewModelBase public class ProfileViewModel : ViewModelBase
{ {
// public string CurrentUsername { get; set; }
private string _CurrentEdition; private string _CurrentEdition;
public string CurrentEdition public string CurrentEdition
{ {
@ -65,8 +63,6 @@ namespace SPT.Launcher.ViewModels
_monitor = new ProcessMonitor("EscapeFromTarkov", 1000, aliveCallback: GameAliveCallBack, exitCallback: GameExitCallback); _monitor = new ProcessMonitor("EscapeFromTarkov", 1000, aliveCallback: GameAliveCallBack, exitCallback: GameExitCallback);
// CurrentUsername = AccountManager.SelectedAccount.username;
CurrentEdition = AccountManager.SelectedAccount.edition; CurrentEdition = AccountManager.SelectedAccount.edition;
CurrentId = AccountManager.SelectedAccount.id; CurrentId = AccountManager.SelectedAccount.id;

View File

@ -11,7 +11,9 @@ using System.Diagnostics;
using System.IO; using System.IO;
using System.Reflection; using System.Reflection;
using System.Threading.Tasks; using System.Threading.Tasks;
using Avalonia.Controls.ApplicationLifetimes;
using Avalonia.Controls.Notifications; using Avalonia.Controls.Notifications;
using Avalonia.Platform.Storage;
namespace SPT.Launcher.ViewModels namespace SPT.Launcher.ViewModels
{ {
@ -148,18 +150,22 @@ namespace SPT.Launcher.ViewModels
public async Task SelectGameFolderCommand() public async Task SelectGameFolderCommand()
{ {
OpenFolderDialog dialog = new OpenFolderDialog(); if (Application.Current.ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
dialog.Directory = Assembly.GetExecutingAssembly().Location;
if (Application.Current?.ApplicationLifetime is Avalonia.Controls.ApplicationLifetimes.IClassicDesktopStyleApplicationLifetime desktop)
{ {
string? result = await dialog.ShowAsync(desktop.MainWindow); var startPath = await desktop.MainWindow.StorageProvider.TryGetFolderFromPathAsync(Assembly.GetExecutingAssembly().Location);
if (result != null) var dir = await desktop.MainWindow.StorageProvider.OpenFolderPickerAsync(new FolderPickerOpenOptions()
{ {
LauncherSettingsProvider.Instance.GamePath = result; Title = "Select your SPT folder",
SuggestedStartLocation = startPath
});
if (dir == null || dir.Count == 0)
{
return;
} }
LauncherSettingsProvider.Instance.GamePath = dir[0].Path.LocalPath;
} }
} }
} }

View File

@ -13,7 +13,7 @@
ProfileInfo="{Binding ProfileInfo}" ProfileInfo="{Binding ProfileInfo}"
CurrentEdition="{Binding CurrentEdition}" CurrentEdition="{Binding CurrentEdition}"
CurrentId="{Binding CurrentId}" CurrentId="{Binding CurrentId}"
WipeProfileOnStart="{Binding WipeProfileOnStart}" WipeProfileOnStart="{Binding WipeProfileOnStart, Mode=TwoWay}"
ProfileWipePending="{Binding ProfileWipePending}" ProfileWipePending="{Binding ProfileWipePending}"
CopyCommand="{Binding CopyCommand}" CopyCommand="{Binding CopyCommand}"
ChangeEditionCommand="{Binding ChangeEditionCommand}" ChangeEditionCommand="{Binding ChangeEditionCommand}"