fix: OpenFolderPickerAsync raise exception when selected a drive root such as E:\

Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
leo 2025-05-30 17:12:56 +08:00
parent 1bd2044589
commit bc5deac9fe
No known key found for this signature in database
8 changed files with 32 additions and 9 deletions

View file

@ -250,7 +250,9 @@ namespace SourceGit.Views
var selected = await StorageProvider.OpenFolderPickerAsync(options);
if (selected.Count == 1)
{
ViewModels.Preferences.Instance.GitDefaultCloneDir = selected[0].Path.LocalPath;
var folder = selected[0];
var folderPath = folder is { Path: { IsAbsoluteUri: true } path } ? path.LocalPath : folder?.Path.ToString();
ViewModels.Preferences.Instance.GitDefaultCloneDir = folderPath;
}
}
catch (Exception ex)