X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/9d8aca4832f9052729d2fc51d25c23f6d7006cab..d8809820cc7aa3a38355b65cd4cb1d4040cfb499:/src/unix/utilsunx.cpp diff --git a/src/unix/utilsunx.cpp b/src/unix/utilsunx.cpp index bbaea579b4..4d670f4ea0 100644 --- a/src/unix/utilsunx.cpp +++ b/src/unix/utilsunx.cpp @@ -203,12 +203,9 @@ void wxMilliSleep(unsigned long milliseconds) int wxKill(long pid, wxSignal sig, wxKillError *rc, int flags) { int err = kill((pid_t) (flags & wxKILL_CHILDREN) ? -pid : pid, (int)sig); - if ( !err ) - *rc = wxKILL_OK; - else if ( rc ) { - switch ( errno ) + switch ( err ? errno : 0 ) { case 0: *rc = wxKILL_OK; @@ -240,9 +237,16 @@ int wxKill(long pid, wxSignal sig, wxKillError *rc, int flags) #define WXEXECUTE_NARGS 127 +#if defined(__DARWIN__) +long wxMacExecute(wxChar **argv, + int flags, + wxProcess *process); +#endif + long wxExecute( const wxString& command, int flags, wxProcess *process ) { - wxCHECK_MSG( !command.IsEmpty(), 0, wxT("can't exec empty command") ); + wxCHECK_MSG( !command.empty(), 0, wxT("can't exec empty command") ); + wxLogDebug(wxString(wxT("Launching: ")) + command); #if wxUSE_THREADS // fork() doesn't mix well with POSIX threads: on many systems the program @@ -309,8 +313,18 @@ long wxExecute( const wxString& command, int flags, wxProcess *process ) } while(*cptr); argv[argc] = NULL; + long lRc; +#if defined(__DARWIN__) + // wxMacExecute only executes app bundles. + // It returns an error code if the target is not an app bundle, thus falling + // through to the regular wxExecute for non app bundles. + lRc = wxMacExecute(argv, flags, process); + if( lRc != ((flags & wxEXEC_SYNC) ? -1 : 0)) + return lRc; +#endif + // do execute the command - long lRc = wxExecute(argv, flags, process); + lRc = wxExecute(argv, flags, process); // clean up argc = 0; @@ -375,6 +389,17 @@ bool wxShutdown(wxShutdownFlags wFlags) return system(wxString::Format(_T("init %c"), level).mb_str()) == 0; } +wxPowerType wxGetPowerType() +{ + // TODO + return wxPOWER_UNKNOWN; +} + +wxBatteryState wxGetBatteryState() +{ + // TODO + return wxBATTERY_UNKNOWN_STATE; +} // ---------------------------------------------------------------------------- // wxStream classes to support IO redirection in wxExecute @@ -427,7 +452,7 @@ bool wxPipeInputStream::CanRead() const #ifdef __VMS #pragma message disable codeunreachable #endif - + long wxExecute(wxChar **argv, int flags, wxProcess *process) @@ -579,7 +604,7 @@ long wxExecute(wxChar **argv, } execvp (*mb_argv, mb_argv); - + fprintf(stderr, "execvp("); // CS changed ppc to ppc_ as ppc is not available under mac os CW Mach-O for ( char **ppc_ = mb_argv; *ppc_; ppc_++ ) @@ -663,9 +688,9 @@ long wxExecute(wxChar **argv, const wxChar* wxGetHomeDir( wxString *home ) { - *home = wxGetUserHome( wxString() ); + *home = wxGetUserHome( wxEmptyString ); wxString tmp; - if ( home->IsEmpty() ) + if ( home->empty() ) *home = wxT("/"); #ifdef __VMS tmp = *home;