applying patch 1188918
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@34005 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
b6d4a1afde
commit
fb19fbabbc
@ -588,6 +588,9 @@ long wxMacExecute(wxChar **argv,
|
|||||||
int flags,
|
int flags,
|
||||||
wxProcess *process)
|
wxProcess *process)
|
||||||
{
|
{
|
||||||
|
const long errorCode = ((flags & wxEXEC_SYNC) ? -1 : 0);
|
||||||
|
const long successCode = ((flags & wxEXEC_SYNC) ? 0 : -1); // fake PID
|
||||||
|
|
||||||
CFIndex cfiCount = 0;
|
CFIndex cfiCount = 0;
|
||||||
//get count
|
//get count
|
||||||
for(wxChar** argvcopy = argv; *argvcopy != NULL ; ++argvcopy)
|
for(wxChar** argvcopy = argv; *argvcopy != NULL ; ++argvcopy)
|
||||||
@ -598,7 +601,7 @@ long wxMacExecute(wxChar **argv,
|
|||||||
if(cfiCount == 0) //no file to launch?
|
if(cfiCount == 0) //no file to launch?
|
||||||
{
|
{
|
||||||
wxLogDebug(wxT("wxMacExecute No file to launch!"));
|
wxLogDebug(wxT("wxMacExecute No file to launch!"));
|
||||||
return -1;
|
return errorCode ;
|
||||||
}
|
}
|
||||||
|
|
||||||
CFURLRef cfurlApp = CFURLCreateWithString(
|
CFURLRef cfurlApp = CFURLCreateWithString(
|
||||||
@ -612,7 +615,7 @@ long wxMacExecute(wxChar **argv,
|
|||||||
{
|
{
|
||||||
wxLogDebug(wxT("wxMacExecute Bad bundle"));
|
wxLogDebug(wxT("wxMacExecute Bad bundle"));
|
||||||
CFRelease(cfurlApp);
|
CFRelease(cfurlApp);
|
||||||
return -1;
|
return errorCode ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -623,14 +626,15 @@ long wxMacExecute(wxChar **argv,
|
|||||||
if(dwBundleType != 'APPL')
|
if(dwBundleType != 'APPL')
|
||||||
{
|
{
|
||||||
CFRelease(cfurlApp);
|
CFRelease(cfurlApp);
|
||||||
return -1;
|
return errorCode ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// We have a good bundle - so let's launch it!
|
// We have a good bundle - so let's launch it!
|
||||||
//
|
//
|
||||||
|
|
||||||
CFMutableArrayRef cfaFiles = CFArrayCreateMutable(kCFAllocatorDefault, cfiCount - 1, NULL);
|
CFMutableArrayRef cfaFiles =
|
||||||
|
CFArrayCreateMutable(kCFAllocatorDefault, cfiCount - 1, &kCFTypeArrayCallBacks);
|
||||||
|
|
||||||
wxASSERT(cfaFiles);
|
wxASSERT(cfaFiles);
|
||||||
|
|
||||||
@ -656,6 +660,7 @@ long wxMacExecute(wxChar **argv,
|
|||||||
cfaFiles,
|
cfaFiles,
|
||||||
cfurlCurrentFile
|
cfurlCurrentFile
|
||||||
);
|
);
|
||||||
|
CFRelease(cfurlCurrentFile); // array has retained it
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -677,9 +682,9 @@ long wxMacExecute(wxChar **argv,
|
|||||||
if(status != noErr)
|
if(status != noErr)
|
||||||
{
|
{
|
||||||
wxLogDebug(wxString::Format(wxT("wxMacExecute ERROR: %d")), (int)status);
|
wxLogDebug(wxString::Format(wxT("wxMacExecute ERROR: %d")), (int)status);
|
||||||
return -1;
|
return errorCode ;
|
||||||
}
|
}
|
||||||
return 0; //success
|
return successCode; //success
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif //__DARWIN__
|
#endif //__DARWIN__
|
||||||
|
@ -316,10 +316,10 @@ long wxExecute( const wxString& command, int flags, wxProcess *process )
|
|||||||
long lRc;
|
long lRc;
|
||||||
#if defined(__DARWIN__)
|
#if defined(__DARWIN__)
|
||||||
// wxMacExecute only executes app bundles.
|
// wxMacExecute only executes app bundles.
|
||||||
// It returns -1 if the target is not an app bundle, thus falling through
|
// It returns an error code if the target is not an app bundle, thus falling
|
||||||
// to the regular wxExecute for non app bundles.
|
// through to the regular wxExecute for non app bundles.
|
||||||
lRc = wxMacExecute(argv, flags, process);
|
lRc = wxMacExecute(argv, flags, process);
|
||||||
if( lRc != -1)
|
if( lRc != ((flags & wxEXEC_SYNC) ? -1 : 0))
|
||||||
return lRc;
|
return lRc;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user