From a4497ce375fb76fe07c8ceb18741a57039abd2c9 Mon Sep 17 00:00:00 2001 From: Itamar Date: Mon, 16 Mar 2020 22:23:17 +0200 Subject: [PATCH] FileManager: chdir to appropriate directory before starting Terminal --- Applications/FileManager/main.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Applications/FileManager/main.cpp b/Applications/FileManager/main.cpp index d3da9b9f259..0372b9e4d79 100644 --- a/Applications/FileManager/main.cpp +++ b/Applications/FileManager/main.cpp @@ -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); }