From 8a24c37deef374bf138569d50221e34fbc97ee98 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 29 Dec 2012 23:33:46 +0300 Subject: add open browser support for MacOSX. --- src/utils/process.cpp | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) (limited to 'src/utils') diff --git a/src/utils/process.cpp b/src/utils/process.cpp index f284cc7e1..56f26b2fa 100644 --- a/src/utils/process.cpp +++ b/src/utils/process.cpp @@ -96,12 +96,6 @@ bool execFile(std::string pathName, std::string name A_UNUSED, return res; } -bool openBrowser(std::string url) -{ - return (int)ShellExecute(nullptr, "open", url.c_str(), nullptr, - nullptr, SW_SHOWNORMAL) > 32; -} - #elif defined __linux__ || defined __linux || defined __APPLE__ @@ -210,11 +204,6 @@ bool execFile(std::string pathName, std::string name, return true; } -bool openBrowser(std::string url) -{ - return execFile("/usr/bin/xdg-open", "/usr/bin/xdg-open", url, "") == 0; -} - #else int execFileWait(std::string pathName, std::string name, @@ -229,6 +218,27 @@ bool execFile(std::string pathName, std::string name, return false; } +#endif + +#ifdef WIN32 +bool openBrowser(std::string url) +{ + return (int)ShellExecute(nullptr, "open", url.c_str(), nullptr, + nullptr, SW_SHOWNORMAL) > 32; +} + +#elif defined __linux__ || defined __linux +bool openBrowser(std::string url) +{ + return execFile("/usr/bin/xdg-open", "/usr/bin/xdg-open", url, "") == 0; +} +#elif defined __APPLE__ +bool openBrowser(std::string url) +{ + return execFile("/usr/bin/open", "/usr/bin/open", url, "") == 0; +} + +#else bool openBrowser(std::string url) { return false; -- cgit v1.2.3-60-g2f50