From 811a5f122fee1a1badc1ced4d530aa8c19788040 Mon Sep 17 00:00:00 2001 From: blankie Date: Wed, 29 Mar 2023 22:21:55 +0700 Subject: [PATCH] Ignore errors when trying to open the file picker xdg-desktop-portal-gtk sends a response code essentially indicating that it failed to open the file picker[0] when you close the file picker without using the Cancel button[1]. There does not seem to be any way for the portal to indicate any other kinds of exit conditions aside from success, cancel, or failure[2]. Additionally, Kotatogram[3] and Firefox[4] does not display an error if the portal cannot bring up the file picker. [0] https://github.com/flatpak/xdg-desktop-portal-gtk/blob/dc8e1d11382f3c173017844d766fb052b1a86f2f/src/filechooser.c#L230 [1] https://docs.gtk.org/gtk3/enum.ResponseType.html#delete_event [2] https://flatpak.github.io/xdg-desktop-portal/#gdbus-signal-org-freedesktop-portal-Request.Response [3] https://github.com/kotatogram/kotatogram-desktop/blob/5b6f711b6d1d089e1c2aaa0ace65ebd5abd57d60/Telegram/SourceFiles/platform/linux/linux_xdp_file_dialog.cpp#L622 [4] https://searchfox.org/mozilla-central/rev/42747dfd314e4c939dc7c33a13e1a2fddf4926fc/widget/gtk/nsFilePicker.cpp#590 --- fragments/export.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fragments/export.cpp b/fragments/export.cpp index 5349e99..e5b87fe 100644 --- a/fragments/export.cpp +++ b/fragments/export.cpp @@ -113,7 +113,7 @@ static inline std::optional save_file_picker() { } else if (res == NFD_CANCEL) { // dialog was canceled, shrug } else { - log(std::string("Failed to open file picker: ") + NFD_GetError()); + // ignore error when failing to open the file picker } return std::nullopt;