From 194ef397a677eb1bdc435c376cfd075c14c51788 Mon Sep 17 00:00:00 2001 From: Lawrence Lee <45837045+Lawrence37@users.noreply.github.com> Date: Sun, 8 Jan 2023 22:17:21 -0800 Subject: [PATCH] Fix external editor file chooser filter (Windows) Look for files with the MIME type "application/x-msdownload", which are Windows executable files. The Gio function for determining if a file is executable does not work for Windows. --- rtgui/externaleditorpreferences.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/rtgui/externaleditorpreferences.cc b/rtgui/externaleditorpreferences.cc index 58a562725..79dac52d2 100644 --- a/rtgui/externaleditorpreferences.cc +++ b/rtgui/externaleditorpreferences.cc @@ -274,7 +274,11 @@ void ExternalEditorPreferences::openFileChooserDialog() const auto exe_filter = Gtk::FileFilter::create(); exe_filter->set_name(M("FILECHOOSER_FILTER_EXECUTABLE")); exe_filter->add_custom(Gtk::FILE_FILTER_MIME_TYPE, [](const Gtk::FileFilter::Info &info) { +#ifdef WIN32 + return info.mime_type == "application/x-msdownload"; +#else return Gio::content_type_can_be_executable(info.mime_type); +#endif }); const auto all_filter = Gtk::FileFilter::create(); all_filter->set_name(M("FILECHOOSER_FILTER_ANY"));