diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-12-29 23:33:46 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-12-29 23:33:46 +0300 |
commit | 8a24c37deef374bf138569d50221e34fbc97ee98 (patch) | |
tree | a9d9b91a3b164753d01d95c1d5e031c5b2f2a4e1 /src/utils | |
parent | da44874127b07449e9c53f19179b99d300384a8b (diff) | |
download | mv-8a24c37deef374bf138569d50221e34fbc97ee98.tar.gz mv-8a24c37deef374bf138569d50221e34fbc97ee98.tar.bz2 mv-8a24c37deef374bf138569d50221e34fbc97ee98.tar.xz mv-8a24c37deef374bf138569d50221e34fbc97ee98.zip |
add open browser support for MacOSX.
Diffstat (limited to 'src/utils')
-rw-r--r-- | src/utils/process.cpp | 32 |
1 files changed, 21 insertions, 11 deletions
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; |