mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 22:38:13 +00:00
FileManager: Set chdir to the current path when opening applications
This commit is contained in:
parent
49ae73022c
commit
35cc5b9873
1 changed files with 7 additions and 1 deletions
|
@ -448,10 +448,16 @@ void DirectoryView::launch(URL const&, LauncherHandler const& launcher_handler)
|
|||
{
|
||||
pid_t child;
|
||||
if (launcher_handler.details().launcher_type == Desktop::Launcher::LauncherType::Application) {
|
||||
posix_spawn_file_actions_t spawn_actions;
|
||||
posix_spawn_file_actions_init(&spawn_actions);
|
||||
posix_spawn_file_actions_addchdir(&spawn_actions, path().characters());
|
||||
|
||||
char const* argv[] = { launcher_handler.details().name.characters(), nullptr };
|
||||
posix_spawn(&child, launcher_handler.details().executable.characters(), nullptr, nullptr, const_cast<char**>(argv), environ);
|
||||
posix_spawn(&child, launcher_handler.details().executable.characters(), &spawn_actions, nullptr, const_cast<char**>(argv), environ);
|
||||
if (disown(child) < 0)
|
||||
perror("disown");
|
||||
|
||||
posix_spawn_file_actions_destroy(&spawn_actions);
|
||||
} else {
|
||||
for (auto& path : selected_file_paths()) {
|
||||
char const* argv[] = { launcher_handler.details().name.characters(), path.characters(), nullptr };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue