diff --git a/Base/home/anon/.config/LaunchServer.ini b/Base/home/anon/.config/LaunchServer.ini index afa150f254..3307da38ae 100644 --- a/Base/home/anon/.config/LaunchServer.ini +++ b/Base/home/anon/.config/LaunchServer.ini @@ -17,6 +17,7 @@ font=/bin/FontEditor sheets=/bin/Spreadsheet gml=/bin/Playground pdf=/bin/PDFViewer +directory=/bin/FileManager *=/bin/TextEditor [Protocol] diff --git a/Userland/Services/LaunchServer/Launcher.cpp b/Userland/Services/LaunchServer/Launcher.cpp index ed3baa0fd1..1d3c39e748 100644 --- a/Userland/Services/LaunchServer/Launcher.cpp +++ b/Userland/Services/LaunchServer/Launcher.cpp @@ -257,9 +257,12 @@ void Launcher::for_each_handler_for_path(const String& path, Function fm_arguments; if (url.fragment().is_empty()) { @@ -293,7 +295,13 @@ bool Launcher::open_file_url(const URL& url) fm_arguments.append("-r"); fm_arguments.append(String::formatted("{}/{}", url.path(), url.fragment())); } - return spawn("/bin/FileManager", fm_arguments); + + auto handler_optional = m_file_handlers.get("directory"); + if (!handler_optional.has_value()) + return false; + auto& handler = handler_optional.value(); + + return spawn(handler, fm_arguments); } if ((st.st_mode & S_IFMT) == S_IFREG && st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)) @@ -304,7 +312,12 @@ bool Launcher::open_file_url(const URL& url) if (extension_parts.size() > 1) extension = extension_parts.last(); - // Additional parameters parsing, specific for the file protocol and TextEditor + auto handler_optional = m_file_handlers.get("txt"); + if (!handler_optional.has_value()) + return false; + auto& default_handler = handler_optional.value(); + + // Additional parameters parsing, specific for the file protocol and txt file handlers Vector additional_parameters; String filepath = url.path(); @@ -318,9 +331,6 @@ bool Launcher::open_file_url(const URL& url) filepath = String::formatted("{}:{}", filepath, line.value()); } } - - additional_parameters.append(filepath); - - return open_with_user_preferences(m_file_handlers, extension, additional_parameters, "/bin/TextEditor"); + return open_with_user_preferences(m_file_handlers, extension, additional_parameters, default_handler); } }