On OS-X, used NSWorkspace to launch the browser.
This commit is contained in:
parent
ff91fec1bb
commit
8aeb650d16
3 changed files with 25 additions and 0 deletions
|
@ -62,4 +62,9 @@ private:
|
|||
|
||||
};
|
||||
|
||||
/**
|
||||
* open a URL using the system's web-browser
|
||||
*/
|
||||
void cocoaOpenUrl(const std::string& url);
|
||||
|
||||
#endif // __MENUBAR_HXX
|
||||
|
|
|
@ -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];
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Reference in a new issue