mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-10 13:00:29 +03:00
Taskbar: Use the AppFile's spawn method to launch applications
A future patch will add argument support to the AppFile. This patch means one less place that needs to be updated to support that.
This commit is contained in:
parent
dccd1cd348
commit
ca4891f5b3
Notes:
sideshowbarker
2024-07-17 08:35:21 +09:00
Author: https://github.com/trflynn89 Commit: https://github.com/SerenityOS/serenity/commit/ca4891f5b3 Pull-request: https://github.com/SerenityOS/serenity/pull/24171 Reviewed-by: https://github.com/ADKaster ✅
@ -61,22 +61,7 @@ OwnPtr<QuickLaunchEntry> QuickLaunchEntry::create_from_path(StringView path)
|
||||
|
||||
ErrorOr<void> QuickLaunchEntryAppFile::launch() const
|
||||
{
|
||||
auto executable = m_app_file->executable();
|
||||
|
||||
pid_t pid = TRY(Core::System::fork());
|
||||
if (pid == 0) {
|
||||
if (chdir(Core::StandardPaths::home_directory().characters()) < 0) {
|
||||
perror("chdir");
|
||||
exit(1);
|
||||
}
|
||||
if (m_app_file->run_in_terminal())
|
||||
execl("/bin/Terminal", "Terminal", "-e", executable.characters(), nullptr);
|
||||
else
|
||||
execl(executable.characters(), executable.characters(), nullptr);
|
||||
perror("execl");
|
||||
VERIFY_NOT_REACHED();
|
||||
} else
|
||||
TRY(Core::System::disown(pid));
|
||||
TRY(m_app_file->spawn_with_escalation());
|
||||
return {};
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user