From 1c655154dd4d88a1204c35d0883b524d23d597fc Mon Sep 17 00:00:00 2001 From: Antoine Pilote Date: Mon, 14 Aug 2023 01:18:22 -0400 Subject: [PATCH] Added OS open URL function --- Nuake/src/Core/OS.cpp | 5 +++++ Nuake/src/Core/OS.h | 1 + 2 files changed, 6 insertions(+) diff --git a/Nuake/src/Core/OS.cpp b/Nuake/src/Core/OS.cpp index eb9bc215..a4d1636c 100644 --- a/Nuake/src/Core/OS.cpp +++ b/Nuake/src/Core/OS.cpp @@ -67,4 +67,9 @@ int OS::RenameDirectory(const Ref& dir, const std::string& newName) void OS::ShowInFileExplorer(const std::string& filePath) { ShellExecuteA(nullptr, "open", "explorer.exe", ("/select," + std::string(filePath)).c_str(), nullptr, SW_SHOWDEFAULT); +} + +void OS::OpenURL(const std::string& url) +{ + ShellExecute(nullptr, nullptr, std::wstring(url.begin(), url.end()).c_str(), 0, 0, SW_SHOW); } \ No newline at end of file diff --git a/Nuake/src/Core/OS.h b/Nuake/src/Core/OS.h index c1b5b8e3..fb96e018 100644 --- a/Nuake/src/Core/OS.h +++ b/Nuake/src/Core/OS.h @@ -15,5 +15,6 @@ namespace Nuake static int OS::RenameFile(const Ref& file, const std::string& newName); static int OS::RenameDirectory(const Ref& dir, const std::string& newName); static void ShowInFileExplorer(const std::string& filePath); + static void OpenURL(const std::string& url); }; }