]> git.saurik.com Git - wxWidgets.git/blobdiff - src/mac/carbon/utilsexc.cpp
corrected textbackground for theme text output
[wxWidgets.git] / src / mac / carbon / utilsexc.cpp
index e90ec86c08319e475f949ba14213af24eb59d1a8..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__
@@ -76,7 +91,7 @@ int wxAddProcessCallbackForPid(wxEndProcessData *proc_data, int pid)
     kernResult = task_for_pid(taskOfOurProcess,pid, &machPortForProcess);
     if(kernResult != KERN_SUCCESS)
     {
-        wxLogDebug("no task_for_pid()");
+        wxLogDebug(wxT("no task_for_pid()"));
         // try seeing if it is already dead or something
         // FIXME: a better method would be to call the callback function
         // from idle time until the process terminates. Of course, how