1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 11:47:34 +00:00

LaunchServer+LibDesktop: Open from mime type

Before, LaunchServer would only open files based on their extension.
This wouldn't work if the file had the wrong one.
This commit is contained in:
demostanis 2022-07-22 18:03:22 +02:00 committed by Sam Atkins
parent 031322fde3
commit 48766449e5
4 changed files with 65 additions and 12 deletions

View file

@ -24,6 +24,7 @@ struct Handler {
Type handler_type;
String name;
String executable;
HashTable<String> mime_types {};
HashTable<String> file_types {};
HashTable<String> protocols {};
@ -47,7 +48,9 @@ private:
HashMap<String, Handler> m_handlers;
HashMap<String, String> m_protocol_handlers;
HashMap<String, String> m_file_handlers;
HashMap<String, String> m_mime_handlers;
Optional<String> mime_type_for_file(String path);
Handler get_handler_for_executable(Handler::Type, String const&) const;
void for_each_handler(String const& key, HashMap<String, String>& user_preferences, Function<bool(Handler const&)> f);
void for_each_handler_for_path(String const&, Function<bool(Handler const&)> f);