[Base] LaunchWebBrowser now takes a string view.

This commit is contained in:
gibbed 2021-06-28 12:22:13 -05:00 committed by Rick Gibbed
parent e84ef132ae
commit a12f775c23
3 changed files with 7 additions and 6 deletions

View File

@ -17,7 +17,7 @@
namespace xe {
void LaunchWebBrowser(const std::string& url);
void LaunchWebBrowser(const std::string_view url);
void LaunchFileExplorer(const std::filesystem::path& path);
enum class SimpleMessageBoxType {

View File

@ -18,8 +18,9 @@
namespace xe {
void LaunchWebBrowser(const std::string& url) {
auto cmd = "xdg-open " + url;
void LaunchWebBrowser(const std::string_view url) {
auto cmd = std::string("xdg-open ");
cmd.append(url);
system(cmd.c_str());
}

View File

@ -13,9 +13,9 @@
namespace xe {
void LaunchWebBrowser(const std::string& url) {
auto temp = xe::to_utf16(url);
ShellExecuteW(nullptr, L"open", reinterpret_cast<LPCWSTR>(temp.c_str()),
void LaunchWebBrowser(const std::string_view url) {
auto wide_url = xe::to_utf16(url);
ShellExecuteW(nullptr, L"open", reinterpret_cast<LPCWSTR>(wide_url.c_str()),
nullptr, nullptr, SW_SHOWNORMAL);
}