1
0
Fork 0

On OS-X, used NSWorkspace to launch the browser.

This commit is contained in:
James Turner 2012-05-07 23:49:21 +01:00
parent ff91fec1bb
commit 8aeb650d16
3 changed files with 25 additions and 0 deletions

View file

@ -62,4 +62,9 @@ private:
};
/**
* open a URL using the system's web-browser
*/
void cocoaOpenUrl(const std::string& url);
#endif // __MENUBAR_HXX

View file

@ -297,3 +297,10 @@ void FGCocoaMenuBar::hide()
{
// no-op
}
void cocoaOpenUrl(const std::string& url)
{
CocoaAutoreleasePool pool;
NSURL* nsu = [NSURL URLWithString:stdStringToCocoa(url)];
[[NSWorkspace sharedWorkspace] openURL:nsu];
}

View file

@ -60,6 +60,10 @@
# include <shellapi.h>
#endif
#ifdef SG_MAC
# include "FGCocoaMenuBar.hxx" // for cocoaOpenUrl
#endif
#include "gui.h"
using std::string;
@ -182,6 +186,15 @@ bool openBrowser(string address)
}
}
#ifdef SG_MAC
if (address.find("://")==string::npos) {
address = "file://" + address;
}
cocoaOpenUrl(address);
return ok;
#endif
#ifndef _WIN32
string command = globals->get_browser();