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:
Timothy Flynn 2024-04-30 12:03:21 -04:00 committed by Andrew Kaster
parent dccd1cd348
commit ca4891f5b3
Notes: sideshowbarker 2024-07-17 08:35:21 +09:00

View File

@ -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 {};
}