Added OS open URL function

This commit is contained in:
Antoine Pilote
2023-08-14 01:18:22 -04:00
parent b99ad4ac78
commit 1c655154dd
2 changed files with 6 additions and 0 deletions

View File

@@ -67,4 +67,9 @@ int OS::RenameDirectory(const Ref<Directory>& 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);
}

View File

@@ -15,5 +15,6 @@ namespace Nuake
static int OS::RenameFile(const Ref<File>& file, const std::string& newName);
static int OS::RenameDirectory(const Ref<Directory>& dir, const std::string& newName);
static void ShowInFileExplorer(const std::string& filePath);
static void OpenURL(const std::string& url);
};
}