]> git.saurik.com Git - wxWidgets.git/blobdiff - src/mac/carbon/utilsexc.cpp
Source cleaning: whitespaces, tabs, TRUE/true, FALSE/false, -1/wxID_ANY/wxDefaultCoor...
[wxWidgets.git] / src / mac / carbon / utilsexc.cpp
index 3136b9fd8499686f35dd7e55ecddbee4465406e0..6d7c4e5600b1812b57c782c5f546167a2ce6f82b 100644 (file)
@@ -30,14 +30,29 @@ extern "C" {
 #include <string.h>
 
 #ifndef __DARWIN__
-#define wxEXECUTE_WIN_MESSAGE 10000
 
-long wxExecute(const wxString& command, int flags, wxProcess *handler)
+#include "wx/mac/private.h"
+#include "LaunchServices.h"
+
+long wxExecute(const wxString& command, int flags, wxProcess *WXUNUSED(handler))
 {
-    // TODO
-    wxFAIL_MSG( _T("wxExecute() not yet implemented") );
-    return 0;
+    wxASSERT_MSG( flags == wxEXEC_ASYNC,
+        wxT("wxExecute: Only wxEXEC_ASYNC is supported") );
+
+    FSRef fsRef ;
+    OSErr err = noErr ;
+    err = wxMacPathToFSRef( command , &fsRef ) ;
+    if ( noErr == err )
+    {
+        err = LSOpenFSRef( &fsRef , NULL ) ;
+    }
+
+    // 0 means execution failed. Returning non-zero is a PID, but not
+    // on Mac where PIDs are 64 bits and won't fit in a long, so we
+    // return a dummy value for now.
+    return ( err == noErr ) ? -1 : 0;
 }
+
 #endif
 
 #ifdef __DARWIN__