From 12f21da35e69d8f9b51959c45383cf66fc2e675e Mon Sep 17 00:00:00 2001 From: Seraphima Zykova Date: Tue, 27 Aug 2024 14:31:54 +0200 Subject: [PATCH] [Workspaces->Launcher] Fix launching OBS Studio: set working directory (#34447) --- src/modules/Workspaces/WorkspacesLauncher/AppLauncher.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/modules/Workspaces/WorkspacesLauncher/AppLauncher.cpp b/src/modules/Workspaces/WorkspacesLauncher/AppLauncher.cpp index f78e4030a4..73e89a40d8 100644 --- a/src/modules/Workspaces/WorkspacesLauncher/AppLauncher.cpp +++ b/src/modules/Workspaces/WorkspacesLauncher/AppLauncher.cpp @@ -240,6 +240,8 @@ namespace bool LaunchApp(const std::wstring& appPath, const std::wstring& commandLineArgs, bool elevated, ErrorList& launchErrors) { + std::wstring dir = std::filesystem::path(appPath).parent_path(); + SHELLEXECUTEINFO sei = { 0 }; sei.cbSize = sizeof(SHELLEXECUTEINFO); sei.hwnd = nullptr; @@ -247,7 +249,7 @@ bool LaunchApp(const std::wstring& appPath, const std::wstring& commandLineArgs, sei.lpVerb = elevated ? L"runas" : L"open"; sei.lpFile = appPath.c_str(); sei.lpParameters = commandLineArgs.c_str(); - sei.lpDirectory = nullptr; + sei.lpDirectory = dir.c_str(); sei.nShow = SW_SHOWNORMAL; if (!ShellExecuteEx(&sei))