From 66c98bc1bf75e1776debd3a9eef53863d80851c0 Mon Sep 17 00:00:00 2001 From: dmg Date: Thu, 14 Nov 2024 00:22:31 +0300 Subject: [PATCH] Check if path is file --- src/Avalonia.X11/NativeDialogs/GtkNativeFileDialogs.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Avalonia.X11/NativeDialogs/GtkNativeFileDialogs.cs b/src/Avalonia.X11/NativeDialogs/GtkNativeFileDialogs.cs index 568875c507b..5dfa9a14cef 100644 --- a/src/Avalonia.X11/NativeDialogs/GtkNativeFileDialogs.cs +++ b/src/Avalonia.X11/NativeDialogs/GtkNativeFileDialogs.cs @@ -45,7 +45,7 @@ public override async Task> OpenFilePickerAsync(File var res = await ShowDialog(options.Title, _window, GtkFileChooserAction.Open, options.AllowMultiple, options.SuggestedStartLocation, null, options.FileTypeFilter, null, false) .ConfigureAwait(false); - return res?.Select(f => new BclStorageFile(new FileInfo(f))).ToArray() ?? Array.Empty(); + return res?.Where(f => File.Exists(f)).Select(f => new BclStorageFile(new FileInfo(f))).ToArray() ?? Array.Empty(); }); }