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.
This commit is contained in:
Lawrence Lee
2023-01-08 22:17:21 -08:00
parent 5468e74e57
commit 194ef397a6

View File

@@ -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"));