+
+#if wxUSE_GUI
+
+// ----------------------------------------------------------------------------
+// Launch document with default app
+// ----------------------------------------------------------------------------
+
+bool wxLaunchDefaultApplication(const wxString& document, int flags)
+{
+ wxUnusedVar(flags);
+
+ wxCFRef<CFMutableStringRef> cfMutableString(CFStringCreateMutableCopy(NULL, 0, wxCFStringRef(document)));
+ CFStringNormalize(cfMutableString,kCFStringNormalizationFormD);
+ wxCFRef<CFURLRef> curl(CFURLCreateWithFileSystemPath(kCFAllocatorDefault, cfMutableString , kCFURLPOSIXPathStyle, false));
+ OSStatus err = LSOpenCFURLRef( curl , NULL );
+
+ if (err == noErr)
+ {
+ return true;
+ }
+ else
+ {
+ wxLogDebug(wxT("Default Application Launch error %d"), (int) err);
+ return false;
+ }
+}
+
+// ----------------------------------------------------------------------------
+// Launch default browser
+// ----------------------------------------------------------------------------
+
+bool wxDoLaunchDefaultBrowser(const wxString& url, int flags)
+{
+ wxUnusedVar(flags);
+ wxCFRef< CFURLRef > curl( CFURLCreateWithString( kCFAllocatorDefault,
+ wxCFStringRef( url ), NULL ) );
+ OSStatus err = LSOpenCFURLRef( curl , NULL );
+
+ if (err == noErr)
+ {
+ return true;
+ }
+ else
+ {
+ wxLogDebug(wxT("Browser Launch error %d"), (int) err);
+ return false;
+ }
+}
+
+#endif // wxUSE_GUI
+