mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-16 19:57:57 +01:00
[Workspaces->Launcher] Fix launching OBS Studio: set working directory (#34447)
This commit is contained in:
@@ -240,6 +240,8 @@ namespace
|
|||||||
|
|
||||||
bool LaunchApp(const std::wstring& appPath, const std::wstring& commandLineArgs, bool elevated, ErrorList& launchErrors)
|
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 };
|
SHELLEXECUTEINFO sei = { 0 };
|
||||||
sei.cbSize = sizeof(SHELLEXECUTEINFO);
|
sei.cbSize = sizeof(SHELLEXECUTEINFO);
|
||||||
sei.hwnd = nullptr;
|
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.lpVerb = elevated ? L"runas" : L"open";
|
||||||
sei.lpFile = appPath.c_str();
|
sei.lpFile = appPath.c_str();
|
||||||
sei.lpParameters = commandLineArgs.c_str();
|
sei.lpParameters = commandLineArgs.c_str();
|
||||||
sei.lpDirectory = nullptr;
|
sei.lpDirectory = dir.c_str();
|
||||||
sei.nShow = SW_SHOWNORMAL;
|
sei.nShow = SW_SHOWNORMAL;
|
||||||
|
|
||||||
if (!ShellExecuteEx(&sei))
|
if (!ShellExecuteEx(&sei))
|
||||||
|
|||||||
Reference in New Issue
Block a user