From a12f775c23ed60d502d34c07cedcfbaacb323794 Mon Sep 17 00:00:00 2001 From: gibbed Date: Mon, 28 Jun 2021 12:22:13 -0500 Subject: [PATCH] [Base] LaunchWebBrowser now takes a string view. --- src/xenia/base/system.h | 2 +- src/xenia/base/system_linux.cc | 5 +++-- src/xenia/base/system_win.cc | 6 +++--- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/xenia/base/system.h b/src/xenia/base/system.h index 75594db63..e69a95eb5 100644 --- a/src/xenia/base/system.h +++ b/src/xenia/base/system.h @@ -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 { diff --git a/src/xenia/base/system_linux.cc b/src/xenia/base/system_linux.cc index 368acd172..7be020cda 100644 --- a/src/xenia/base/system_linux.cc +++ b/src/xenia/base/system_linux.cc @@ -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()); } diff --git a/src/xenia/base/system_win.cc b/src/xenia/base/system_win.cc index 8094ddb90..ae77ae1d4 100644 --- a/src/xenia/base/system_win.cc +++ b/src/xenia/base/system_win.cc @@ -13,9 +13,9 @@ namespace xe { -void LaunchWebBrowser(const std::string& url) { - auto temp = xe::to_utf16(url); - ShellExecuteW(nullptr, L"open", reinterpret_cast(temp.c_str()), +void LaunchWebBrowser(const std::string_view url) { + auto wide_url = xe::to_utf16(url); + ShellExecuteW(nullptr, L"open", reinterpret_cast(wide_url.c_str()), nullptr, nullptr, SW_SHOWNORMAL); }