Skip to content

Commit

Permalink
More file picker fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Deadpikle committed Nov 7, 2024
1 parent 09cb1fb commit c2d9c26
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions EasyBackupAvalonia/ViewModels/SetupBackupViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -296,11 +296,14 @@ private async void LoadItemsFromDisk()
if (GetTopLevel()?.StorageProvider is IStorageProvider { CanOpen: true } provider)
{
var lastSaveExists = File.Exists(_lastSaveFilePath);
var lastPath = lastSaveExists ? Path.GetFileName(_lastSaveFilePath) : "";
var lastFileName = lastSaveExists ? Path.GetFileName(_lastSaveFilePath) : "";
var lastPath = lastSaveExists ? _lastSaveFilePath : "";
var lastPathDirName = Path.GetDirectoryName(lastPath);
var suggestedStartLocation = await provider.TryGetFolderFromPathAsync(lastPathDirName);
var results = await provider.OpenFilePickerAsync(new FilePickerOpenOptions()
{
Title = "Choose EasyBackup File",
SuggestedStartLocation = await provider.TryGetFolderFromPathAsync(lastPath),
SuggestedStartLocation = suggestedStartLocation,
AllowMultiple = false,
FileTypeFilter = new List<FilePickerFileType>()
{
Expand Down Expand Up @@ -344,10 +347,12 @@ private async void PickBackupFolder()
{
if (GetTopLevel()?.StorageProvider is IStorageProvider { CanOpen: true } provider)
{
var startLocation = !string.IsNullOrWhiteSpace(BackupLocation) ? await provider.TryGetFolderFromPathAsync(BackupLocation) : null;
var results = await provider.OpenFolderPickerAsync(new FolderPickerOpenOptions()
{
Title = "Choose backup folder...",
AllowMultiple = false,
SuggestedStartLocation = startLocation
});
if (results.Count == 1)
{
Expand Down

0 comments on commit c2d9c26

Please sign in to comment.