X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/5f3f0f1725cc5e906caa6a81e368d0c8b29702ea..214b94848a50b224aa3b2101b21149ae82e3706f:/src/mac/carbon/utilsexc.cpp diff --git a/src/mac/carbon/utilsexc.cpp b/src/mac/carbon/utilsexc.cpp index e90ec86c08..6d7c4e5600 100644 --- a/src/mac/carbon/utilsexc.cpp +++ b/src/mac/carbon/utilsexc.cpp @@ -30,14 +30,29 @@ extern "C" { #include #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