1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 04:57:45 +00:00

LaunchServer: Check if handler programs exist when registering them

This adds checks in load_handlers() and load_config() to see if the
programs specified in the config files exist before registering them as
handlers.

Resolves #8121
This commit is contained in:
bitwitch 2021-06-18 16:41:58 -04:00 committed by Andreas Kling
parent 79d4913f76
commit f29980a15b

View file

@ -87,6 +87,7 @@ void Launcher::load_handlers(const String& af_dir)
HashTable<String> protocols;
for (auto& protocol : af->launcher_protocols())
protocols.set(protocol);
if (access(app_executable.characters(), X_OK) == 0)
m_handlers.set(app_executable, { Handler::Type::Default, app_name, app_executable, file_types, protocols });
},
af_dir);
@ -98,6 +99,8 @@ void Launcher::load_config(const Core::ConfigFile& cfg)
auto handler = cfg.read_entry("FileType", key).trim_whitespace();
if (handler.is_empty())
continue;
if (access(handler.characters(), X_OK) != 0)
continue;
m_file_handlers.set(key.to_lowercase(), handler);
}
@ -105,6 +108,8 @@ void Launcher::load_config(const Core::ConfigFile& cfg)
auto handler = cfg.read_entry("Protocol", key).trim_whitespace();
if (handler.is_empty())
continue;
if (access(handler.characters(), X_OK) != 0)
continue;
m_protocol_handlers.set(key.to_lowercase(), handler);
}
}