FileManager: chdir to appropriate directory before starting Terminal

This commit is contained in:
Itamar 2020-03-16 22:23:17 +02:00 committed by Andreas Kling
parent bd9f14e27e
commit a4497ce375
Notes: sideshowbarker 2024-07-19 08:16:02 +09:00

View file

@ -189,8 +189,12 @@ int main(int argc, char** argv)
auto open_terminal_action = GUI::Action::create("Open Terminal here...", Gfx::Bitmap::load_from_file("/res/icons/16x16/app-terminal.png"), [&](const GUI::Action&) {
if (!fork()) {
int rc = execl("/bin/Terminal", "Terminal", "-d", directory_view.path().characters(), nullptr);
if (rc < 0)
if (chdir(directory_view.path().characters()) < 0) {
perror("chdir");
exit(1);
}
if (execl("/bin/Terminal", "Terminal", nullptr) < 0)
perror("execl");
exit(1);
}