summaryrefslogtreecommitdiff
path: root/Applications
diff options
context:
space:
mode:
authorItamar <itamar8910@gmail.com>2020-03-16 22:23:17 +0200
committerAndreas Kling <kling@serenityos.org>2020-03-18 08:23:31 +0100
commita4497ce375fb76fe07c8ceb18741a57039abd2c9 (patch)
tree0aa2588b2321a9d12f35872355f800193f0f0af6 /Applications
parentbd9f14e27eed71e7cc657468c7dfad8375d01135 (diff)
downloadserenity-a4497ce375fb76fe07c8ceb18741a57039abd2c9.zip
FileManager: chdir to appropriate directory before starting Terminal
Diffstat (limited to 'Applications')
-rw-r--r--Applications/FileManager/main.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/Applications/FileManager/main.cpp b/Applications/FileManager/main.cpp
index d3da9b9f25..0372b9e4d7 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);
}