X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f0bce4d4e075056231e5a0ce7f338a9822083fc3..d8809820cc7aa3a38355b65cd4cb1d4040cfb499:/src/unix/utilsunx.cpp?ds=inline diff --git a/src/unix/utilsunx.cpp b/src/unix/utilsunx.cpp index cf1cf1240a..4d670f4ea0 100644 --- a/src/unix/utilsunx.cpp +++ b/src/unix/utilsunx.cpp @@ -237,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 @@ -306,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; @@ -372,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 @@ -424,7 +452,7 @@ bool wxPipeInputStream::CanRead() const #ifdef __VMS #pragma message disable codeunreachable #endif - + long wxExecute(wxChar **argv, int flags, wxProcess *process) @@ -576,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_++ ) @@ -660,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;