X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/a31a5f85341a2ef131d86a1dee12f3d6c8156118..a85245b1c2c2b3f49658b2b49f3cbfc5ff9efdd4:/src/mac/carbon/utilsexc.cpp diff --git a/src/mac/carbon/utilsexc.cpp b/src/mac/carbon/utilsexc.cpp index a9e84f42ed..6c82d0ca87 100644 --- a/src/mac/carbon/utilsexc.cpp +++ b/src/mac/carbon/utilsexc.cpp @@ -2,41 +2,42 @@ // Name: utilsexec.cpp // Purpose: Execution-related utilities // Author: Stefan Csomor -// Modified by: +// Modified by: // Created: 1998-01-01 // RCS-ID: $Id$ // Copyright: (c) Stefan Csomor -// Licence: wxWindows licence +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// -#ifdef __GNUG__ -#pragma implementation -#endif - -#include "wx/utils.h" -#ifdef __DARWIN__ -#include "wx/unix/execute.h" -#endif - -#include -#include -#include +#include "wx/wxprec.h" +#ifndef WX_PRECOMP + #include "wx/log.h" + #include "wx/utils.h" +#endif //ndef WX_PRECOMP #ifndef __DARWIN__ -#define wxEXECUTE_WIN_MESSAGE 10000 -long wxExecute(const wxString& command, int flags, wxProcess *handler) -{ - // TODO - wxFAIL_MSG( _T("wxExecute() not yet implemented") ); - return 0; -} -#endif +#include "wx/mac/private.h" +#include "LaunchServices.h" -#ifdef __DARWIN__ -int wxAddProcessCallback(wxEndProcessData *proc_data, int fd) +long wxExecute(const wxString& command, int flags, wxProcess *WXUNUSED(handler)) { - wxFAIL_MSG( _T("wxAddProcessCallback() 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 + +#endif //ndef __DARWIN__ +