Restore the start menu shortcut as a proper launcher for the UI and service

This commit is contained in:
Cameron Gutman
2023-04-29 15:48:13 -05:00
parent 14fd7ad498
commit c4c04694ac
9 changed files with 373 additions and 46 deletions

View File

@ -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;