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:
parent
79d4913f76
commit
f29980a15b
1 changed files with 6 additions and 1 deletions
|
@ -87,7 +87,8 @@ void Launcher::load_handlers(const String& af_dir)
|
||||||
HashTable<String> protocols;
|
HashTable<String> protocols;
|
||||||
for (auto& protocol : af->launcher_protocols())
|
for (auto& protocol : af->launcher_protocols())
|
||||||
protocols.set(protocol);
|
protocols.set(protocol);
|
||||||
m_handlers.set(app_executable, { Handler::Type::Default, app_name, app_executable, file_types, protocols });
|
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);
|
af_dir);
|
||||||
}
|
}
|
||||||
|
@ -98,6 +99,8 @@ void Launcher::load_config(const Core::ConfigFile& cfg)
|
||||||
auto handler = cfg.read_entry("FileType", key).trim_whitespace();
|
auto handler = cfg.read_entry("FileType", key).trim_whitespace();
|
||||||
if (handler.is_empty())
|
if (handler.is_empty())
|
||||||
continue;
|
continue;
|
||||||
|
if (access(handler.characters(), X_OK) != 0)
|
||||||
|
continue;
|
||||||
m_file_handlers.set(key.to_lowercase(), handler);
|
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();
|
auto handler = cfg.read_entry("Protocol", key).trim_whitespace();
|
||||||
if (handler.is_empty())
|
if (handler.is_empty())
|
||||||
continue;
|
continue;
|
||||||
|
if (access(handler.characters(), X_OK) != 0)
|
||||||
|
continue;
|
||||||
m_protocol_handlers.set(key.to_lowercase(), handler);
|
m_protocol_handlers.set(key.to_lowercase(), handler);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue