浏览代码

Taskbar: chdir to home directory before launching apps

Itamar 5 年之前
父节点
当前提交
c18f12bb96
共有 1 个文件被更改,包括 5 次插入0 次删除
  1. 5 0
      Applications/Taskbar/TaskbarWindow.cpp

+ 5 - 0
Applications/Taskbar/TaskbarWindow.cpp

@@ -28,6 +28,7 @@
 #include "TaskbarButton.h"
 #include <AK/SharedBuffer.h>
 #include <LibCore/ConfigFile.h>
+#include <LibCore/UserInfo.h>
 #include <LibGUI/BoxLayout.h>
 #include <LibGUI/Button.h>
 #include <LibGUI/Desktop.h>
@@ -105,6 +106,10 @@ void TaskbarWindow::create_quick_launch_bar()
             if (pid < 0) {
                 perror("fork");
             } else if (pid == 0) {
+                if (chdir(get_current_user_home_path().characters()) < 0) {
+                    perror("chdir");
+                    exit(1);
+                }
                 execl(app_executable.characters(), app_executable.characters(), nullptr);
                 perror("execl");
                 ASSERT_NOT_REACHED();