Use GlosSI LaunchDir for app launch dir

It's setup in Steam shortcuts to be launch-app dir anyway
This allows user customozitation in Steam.
pull/130/head
Peter Repukat 3 years ago
parent aff24b8a7e
commit 1a47ef8c35

@ -126,13 +126,13 @@ void AppLauncher::UnPatchValveHooks()
void AppLauncher::launchWin32App(const std::wstring& path, const std::wstring& args) void AppLauncher::launchWin32App(const std::wstring& path, const std::wstring& args)
{ {
const auto native_seps_path = std::regex_replace(path, std::wregex(L"(\\/|\\\\)"), L"\\"); const auto native_seps_path = std::regex_replace(path, std::wregex(L"(\\/|\\\\)"), L"\\");
std::wstring launch_dir; //std::wstring launch_dir;
std::wsmatch m; //std::wsmatch m;
if (!std::regex_search(native_seps_path, m, std::wregex(L"(.*?\\\\)*"))) { //if (!std::regex_search(native_seps_path, m, std::wregex(L"(.*?\\\\)*"))) {
spdlog::warn("Couldn't detect launch application directory"); // Shouldn't ever happen... // spdlog::warn("Couldn't detect launch application directory"); // Shouldn't ever happen...
} else { //} else {
launch_dir = m[0]; // launch_dir = m[0];
} //}
std::wstring args_cpy(args); std::wstring args_cpy(args);
if (CreateProcessW(native_seps_path.data(), if (CreateProcessW(native_seps_path.data(),
args_cpy.data(), args_cpy.data(),
@ -141,13 +141,15 @@ void AppLauncher::launchWin32App(const std::wstring& path, const std::wstring& a
TRUE, TRUE,
0, 0,
nullptr, nullptr,
launch_dir.empty() ? nullptr : launch_dir.data(), nullptr, //launch_dir.empty() ? nullptr : launch_dir.data(),
&info, &info,
&process_info)) { &process_info)) {
spdlog::info(L"Started Program: \"{}\" in directory: \"{}\"", native_seps_path, launch_dir); //spdlog::info(L"Started Program: \"{}\" in directory: \"{}\"", native_seps_path, launch_dir);
spdlog::info(L"Started Program: \"{}\"", native_seps_path);
} }
else { else {
spdlog::error(L"Couldn't start program: \"{}\" in directory: \"{}\"", native_seps_path, launch_dir); //spdlog::error(L"Couldn't start program: \"{}\" in directory: \"{}\"", native_seps_path, launch_dir);
spdlog::error(L"Couldn't start program: \"{}\" in directory: \"{}\"", native_seps_path);
} }
} }

Loading…
Cancel
Save