mirror of
https://github.com/LizardByte/Sunshine.git
synced 2026-02-04 23:05:23 +00:00
Restore the start menu shortcut as a proper launcher for the UI and service
This commit is contained in:
@ -651,6 +651,31 @@ namespace platf {
|
||||
return create_boost_child_from_results(ret, cmd, ec, process_info, group);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Open a url in the default web browser.
|
||||
* @param url The url to open.
|
||||
*/
|
||||
void
|
||||
open_url(const std::string &url) {
|
||||
// set working dir to Windows system directory
|
||||
auto working_dir = boost::filesystem::path(std::getenv("SystemRoot"));
|
||||
|
||||
// this isn't ideal as it briefly shows a command window
|
||||
// but start a command built into cmd, not an executable
|
||||
std::string cmd = R"(cmd /C "start )" + url + R"(")";
|
||||
|
||||
boost::process::environment _env = boost::this_process::environment();
|
||||
std::error_code ec;
|
||||
auto child = run_command(false, cmd, working_dir, _env, nullptr, ec, nullptr);
|
||||
if (ec) {
|
||||
BOOST_LOG(warning) << "Couldn't open url ["sv << url << "]: System: "sv << ec.message();
|
||||
}
|
||||
else {
|
||||
BOOST_LOG(info) << "Opened url ["sv << url << "]"sv;
|
||||
child.detach();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
adjust_thread_priority(thread_priority_e priority) {
|
||||
int win32_priority;
|
||||
|
||||
Reference in New Issue
Block a user