Merge branch 'remove-mac-launch'

Remove wxMacLaunch() function unused any longer.

See https://github.com/wxWidgets/wxWidgets/pull/1629
This commit is contained in:
Vadim Zeitlin
2019-11-01 14:32:02 +01:00
9 changed files with 10 additions and 277 deletions

View File

@@ -2286,7 +2286,6 @@ COND_TOOLKIT_OSX_COCOA_BASE_OSX_SRC = \
src/osx/core/cfstring.cpp \
src/osx/core/evtloop_cf.cpp \
src/osx/core/strconv_cf.cpp \
src/osx/core/utilsexc_base.cpp \
src/osx/cocoa/utils_base.mm \
src/osx/core/secretstore.cpp \
src/common/fdiodispatcher.cpp \
@@ -2312,7 +2311,6 @@ COND_TOOLKIT_OSX_IPHONE_BASE_OSX_SRC = \
src/osx/core/cfstring.cpp \
src/osx/core/evtloop_cf.cpp \
src/osx/core/strconv_cf.cpp \
src/osx/core/utilsexc_base.cpp \
src/osx/cocoa/utils_base.mm \
src/osx/core/secretstore.cpp \
src/common/fdiodispatcher.cpp \
@@ -2353,7 +2351,6 @@ COND_TOOLKIT_COCOA_BASE_OSX_SRC = \
src/osx/core/cfstring.cpp \
src/osx/core/evtloop_cf.cpp \
src/osx/core/strconv_cf.cpp \
src/osx/core/utilsexc_base.cpp \
src/osx/cocoa/utils_base.mm \
src/osx/core/secretstore.cpp
@COND_TOOLKIT_COCOA@BASE_OSX_SRC = $(COND_TOOLKIT_COCOA_BASE_OSX_SRC)
@@ -2377,7 +2374,6 @@ COND_TOOLKIT_GTK_BASE_OSX_SRC = \
src/osx/core/cfstring.cpp \
src/osx/core/evtloop_cf.cpp \
src/osx/core/strconv_cf.cpp \
src/osx/core/utilsexc_base.cpp \
src/osx/cocoa/utils_base.mm \
src/osx/core/secretstore.cpp
@COND_TOOLKIT_GTK@BASE_OSX_SRC = $(COND_TOOLKIT_GTK_BASE_OSX_SRC)
@@ -2401,7 +2397,6 @@ COND_TOOLKIT_X11_BASE_OSX_SRC = \
src/osx/core/cfstring.cpp \
src/osx/core/evtloop_cf.cpp \
src/osx/core/strconv_cf.cpp \
src/osx/core/utilsexc_base.cpp \
src/osx/cocoa/utils_base.mm \
src/osx/core/secretstore.cpp
@COND_TOOLKIT_X11@BASE_OSX_SRC = $(COND_TOOLKIT_X11_BASE_OSX_SRC)
@@ -2425,7 +2420,6 @@ COND_TOOLKIT_MOTIF_BASE_OSX_SRC = \
src/osx/core/cfstring.cpp \
src/osx/core/evtloop_cf.cpp \
src/osx/core/strconv_cf.cpp \
src/osx/core/utilsexc_base.cpp \
src/osx/cocoa/utils_base.mm \
src/osx/core/secretstore.cpp
@COND_TOOLKIT_MOTIF@BASE_OSX_SRC = $(COND_TOOLKIT_MOTIF_BASE_OSX_SRC)
@@ -2449,7 +2443,6 @@ COND_TOOLKIT__BASE_OSX_SRC = \
src/osx/core/cfstring.cpp \
src/osx/core/evtloop_cf.cpp \
src/osx/core/strconv_cf.cpp \
src/osx/core/utilsexc_base.cpp \
src/osx/cocoa/utils_base.mm \
src/osx/core/secretstore.cpp
@COND_TOOLKIT_@BASE_OSX_SRC = $(COND_TOOLKIT__BASE_OSX_SRC)
@@ -4185,7 +4178,6 @@ COND_PLATFORM_MACOSX_1___BASE_PLATFORM_SRC_OBJECTS = \
monodll_cfstring.o \
monodll_evtloop_cf.o \
monodll_strconv_cf.o \
monodll_utilsexc_base.o \
monodll_utils_base.o \
monodll_core_secretstore.o \
monodll_fdiodispatcher.o \
@@ -6172,7 +6164,6 @@ COND_PLATFORM_MACOSX_1___BASE_PLATFORM_SRC_OBJECTS_1 = \
monolib_cfstring.o \
monolib_evtloop_cf.o \
monolib_strconv_cf.o \
monolib_utilsexc_base.o \
monolib_utils_base.o \
monolib_core_secretstore.o \
monolib_fdiodispatcher.o \
@@ -8211,7 +8202,6 @@ COND_PLATFORM_MACOSX_1___BASE_PLATFORM_SRC_OBJECTS_2 = \
basedll_cfstring.o \
basedll_evtloop_cf.o \
basedll_strconv_cf.o \
basedll_utilsexc_base.o \
basedll_utils_base.o \
basedll_core_secretstore.o \
basedll_fdiodispatcher.o \
@@ -8295,7 +8285,6 @@ COND_PLATFORM_MACOSX_1___BASE_PLATFORM_SRC_OBJECTS_3 = \
baselib_cfstring.o \
baselib_evtloop_cf.o \
baselib_strconv_cf.o \
baselib_utilsexc_base.o \
baselib_utils_base.o \
baselib_core_secretstore.o \
baselib_fdiodispatcher.o \
@@ -15895,9 +15884,6 @@ monodll_evtloop_cf.o: $(srcdir)/src/osx/core/evtloop_cf.cpp $(MONODLL_ODEP)
monodll_strconv_cf.o: $(srcdir)/src/osx/core/strconv_cf.cpp $(MONODLL_ODEP)
$(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/osx/core/strconv_cf.cpp
monodll_utilsexc_base.o: $(srcdir)/src/osx/core/utilsexc_base.cpp $(MONODLL_ODEP)
$(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/osx/core/utilsexc_base.cpp
monodll_utils_base.o: $(srcdir)/src/osx/cocoa/utils_base.mm $(MONODLL_ODEP)
$(CXXC) -c -o $@ $(MONODLL_OBJCXXFLAGS) $(srcdir)/src/osx/cocoa/utils_base.mm
@@ -21166,9 +21152,6 @@ monolib_evtloop_cf.o: $(srcdir)/src/osx/core/evtloop_cf.cpp $(MONOLIB_ODEP)
monolib_strconv_cf.o: $(srcdir)/src/osx/core/strconv_cf.cpp $(MONOLIB_ODEP)
$(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/osx/core/strconv_cf.cpp
monolib_utilsexc_base.o: $(srcdir)/src/osx/core/utilsexc_base.cpp $(MONOLIB_ODEP)
$(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/osx/core/utilsexc_base.cpp
monolib_utils_base.o: $(srcdir)/src/osx/cocoa/utils_base.mm $(MONOLIB_ODEP)
$(CXXC) -c -o $@ $(MONOLIB_OBJCXXFLAGS) $(srcdir)/src/osx/cocoa/utils_base.mm
@@ -26437,9 +26420,6 @@ basedll_evtloop_cf.o: $(srcdir)/src/osx/core/evtloop_cf.cpp $(BASEDLL_ODEP)
basedll_strconv_cf.o: $(srcdir)/src/osx/core/strconv_cf.cpp $(BASEDLL_ODEP)
$(CXXC) -c -o $@ $(BASEDLL_CXXFLAGS) $(srcdir)/src/osx/core/strconv_cf.cpp
basedll_utilsexc_base.o: $(srcdir)/src/osx/core/utilsexc_base.cpp $(BASEDLL_ODEP)
$(CXXC) -c -o $@ $(BASEDLL_CXXFLAGS) $(srcdir)/src/osx/core/utilsexc_base.cpp
basedll_utils_base.o: $(srcdir)/src/osx/cocoa/utils_base.mm $(BASEDLL_ODEP)
$(CXXC) -c -o $@ $(BASEDLL_OBJCXXFLAGS) $(srcdir)/src/osx/cocoa/utils_base.mm
@@ -26914,9 +26894,6 @@ baselib_evtloop_cf.o: $(srcdir)/src/osx/core/evtloop_cf.cpp $(BASELIB_ODEP)
baselib_strconv_cf.o: $(srcdir)/src/osx/core/strconv_cf.cpp $(BASELIB_ODEP)
$(CXXC) -c -o $@ $(BASELIB_CXXFLAGS) $(srcdir)/src/osx/core/strconv_cf.cpp
baselib_utilsexc_base.o: $(srcdir)/src/osx/core/utilsexc_base.cpp $(BASELIB_ODEP)
$(CXXC) -c -o $@ $(BASELIB_CXXFLAGS) $(srcdir)/src/osx/core/utilsexc_base.cpp
baselib_utils_base.o: $(srcdir)/src/osx/cocoa/utils_base.mm $(BASELIB_ODEP)
$(CXXC) -c -o $@ $(BASELIB_OBJCXXFLAGS) $(srcdir)/src/osx/cocoa/utils_base.mm

View File

@@ -185,7 +185,6 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
src/osx/core/cfstring.cpp
src/osx/core/evtloop_cf.cpp
src/osx/core/strconv_cf.cpp
src/osx/core/utilsexc_base.cpp
src/osx/cocoa/utils_base.mm
src/osx/core/secretstore.cpp
</set>

View File

@@ -113,7 +113,6 @@ set(BASE_COREFOUNDATION_SRC
src/osx/core/evtloop_cf.cpp
src/osx/core/secretstore.cpp
src/osx/core/strconv_cf.cpp
src/osx/core/utilsexc_base.cpp
src/osx/cocoa/utils_base.mm
)

View File

@@ -139,7 +139,6 @@ BASE_COREFOUNDATION_SRC =
src/osx/core/evtloop_cf.cpp
src/osx/core/secretstore.cpp
src/osx/core/strconv_cf.cpp
src/osx/core/utilsexc_base.cpp
src/osx/cocoa/utils_base.mm
BASE_COREFOUNDATION_HDR =

View File

@@ -980,9 +980,6 @@
4DD98A9436C83CF3B9425A78 /* sysopt.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F32F6B47EBB23068B1FCDC0D /* sysopt.cpp */; };
4DD98A9436C83CF3B9425A79 /* sysopt.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F32F6B47EBB23068B1FCDC0D /* sysopt.cpp */; };
4DD98A9436C83CF3B9425A7A /* sysopt.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F32F6B47EBB23068B1FCDC0D /* sysopt.cpp */; };
4E140367282F38C8A904A004 /* utilsexc_base.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 81390F96937631078EFCD891 /* utilsexc_base.cpp */; };
4E140367282F38C8A904A005 /* utilsexc_base.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 81390F96937631078EFCD891 /* utilsexc_base.cpp */; };
4E140367282F38C8A904A006 /* utilsexc_base.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 81390F96937631078EFCD891 /* utilsexc_base.cpp */; };
4E2737AC738431EB9898B8B6 /* gzwrite.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E4E3EB1CCA53E0EA322A1AF /* gzwrite.c */; };
4E2737AC738431EB9898B8B7 /* gzwrite.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E4E3EB1CCA53E0EA322A1AF /* gzwrite.c */; };
4E2737AC738431EB9898B8B8 /* gzwrite.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E4E3EB1CCA53E0EA322A1AF /* gzwrite.c */; };
@@ -4334,7 +4331,6 @@
7FE0455EBDC63D82B2D88587 /* jcprepct.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = jcprepct.c; path = ../../src/jpeg/jcprepct.c; sourceTree = "<group>"; };
810EB7316DF3344197C78EC0 /* jcmainct.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = jcmainct.c; path = ../../src/jpeg/jcmainct.c; sourceTree = "<group>"; };
81122210DB7A350983E32AEC /* libwx_osx_cocoau_aui.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libwx_osx_cocoau_aui.dylib; sourceTree = BUILT_PRODUCTS_DIR; };
81390F96937631078EFCD891 /* utilsexc_base.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = utilsexc_base.cpp; path = ../../src/osx/core/utilsexc_base.cpp; sourceTree = "<group>"; };
81708CFA21A03013ACB8DDD7 /* checkbox.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; name = checkbox.mm; path = ../../src/osx/cocoa/checkbox.mm; sourceTree = "<group>"; };
81821049E39B32C6ABCF6820 /* helpdlg.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = helpdlg.cpp; path = ../../src/html/helpdlg.cpp; sourceTree = "<group>"; };
81A30C745CA73E30B788B408 /* image.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = image.cpp; path = ../../src/common/image.cpp; sourceTree = "<group>"; };
@@ -6063,7 +6059,6 @@
5168ADF7BE39351F8F24E1E6 /* cfstring.cpp */,
5BD6231188AB329CAA5E1171 /* evtloop_cf.cpp */,
D5F9383D1CE931499F339D85 /* strconv_cf.cpp */,
81390F96937631078EFCD891 /* utilsexc_base.cpp */,
2ED0C0702D2734D9B08FC31D /* utils_base.mm */,
5BE1FB352696346BB642C045 /* secretstore.cpp */,
47F784C2BB5A3B5DAD276583 /* fdiodispatcher.cpp */,
@@ -7469,7 +7464,6 @@
1DBDF75500D73A3098015E81 /* cfstring.cpp in Sources */,
9FBC642677C63D01AA2511BE /* evtloop_cf.cpp in Sources */,
AAAB5DF8E60736D88273DD00 /* strconv_cf.cpp in Sources */,
4E140367282F38C8A904A006 /* utilsexc_base.cpp in Sources */,
68C300D096BF39239876D045 /* utils_base.mm in Sources */,
B0FD1B96EAE635AFBFCF2C96 /* secretstore.cpp in Sources */,
D36E76A4CAF5352D9397E201 /* fdiodispatcher.cpp in Sources */,
@@ -8184,7 +8178,6 @@
1DBDF75500D73A3098015E80 /* cfstring.cpp in Sources */,
9FBC642677C63D01AA2511BD /* evtloop_cf.cpp in Sources */,
AAAB5DF8E60736D88273DCFF /* strconv_cf.cpp in Sources */,
4E140367282F38C8A904A005 /* utilsexc_base.cpp in Sources */,
68C300D096BF39239876D044 /* utils_base.mm in Sources */,
B0FD1B96EAE635AFBFCF2C95 /* secretstore.cpp in Sources */,
D36E76A4CAF5352D9397E200 /* fdiodispatcher.cpp in Sources */,
@@ -9412,7 +9405,6 @@
1DBDF75500D73A3098015E7F /* cfstring.cpp in Sources */,
9FBC642677C63D01AA2511BC /* evtloop_cf.cpp in Sources */,
AAAB5DF8E60736D88273DCFE /* strconv_cf.cpp in Sources */,
4E140367282F38C8A904A004 /* utilsexc_base.cpp in Sources */,
68C300D096BF39239876D043 /* utils_base.mm in Sources */,
B0FD1B96EAE635AFBFCF2C94 /* secretstore.cpp in Sources */,
D36E76A4CAF5352D9397E1FF /* fdiodispatcher.cpp in Sources */,

View File

@@ -274,7 +274,6 @@
4D0BA8B9F72C3C31BC170CE2 /* progdlgg.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BEA102FF0FFC33DEAEF2FE14 /* progdlgg.cpp */; };
4DA209AEF4AD32AAB97F9718 /* htmlcell.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 68E5188DB6003C35A8C7754D /* htmlcell.cpp */; };
4DD98A9436C83CF3B9425A78 /* sysopt.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F32F6B47EBB23068B1FCDC0D /* sysopt.cpp */; };
4E140367282F38C8A904A004 /* utilsexc_base.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 81390F96937631078EFCD891 /* utilsexc_base.cpp */; };
4E2737AC738431EB9898B8B6 /* gzwrite.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E4E3EB1CCA53E0EA322A1AF /* gzwrite.c */; };
4E396D8D2E9138D797F320C6 /* tif_aux.c in Sources */ = {isa = PBXBuildFile; fileRef = D0CDADAF2D893E32A38351E4 /* tif_aux.c */; };
502D7B786EAE383B9546F31F /* LexRust.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 24BD2EF635673E819B8406CB /* LexRust.cxx */; };
@@ -1277,7 +1276,6 @@
7FCA75FE592C3469AE351FBF /* winpars.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = winpars.cpp; path = ../../src/html/winpars.cpp; sourceTree = "<group>"; };
7FE0455EBDC63D82B2D88587 /* jcprepct.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = jcprepct.c; path = ../../src/jpeg/jcprepct.c; sourceTree = "<group>"; };
810EB7316DF3344197C78EC0 /* jcmainct.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = jcmainct.c; path = ../../src/jpeg/jcmainct.c; sourceTree = "<group>"; };
81390F96937631078EFCD891 /* utilsexc_base.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = utilsexc_base.cpp; path = ../../src/osx/core/utilsexc_base.cpp; sourceTree = "<group>"; };
81708CFA21A03013ACB8DDD7 /* checkbox.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; name = checkbox.mm; path = ../../src/osx/iphone/checkbox.mm; sourceTree = "<group>"; };
81821049E39B32C6ABCF6820 /* helpdlg.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = helpdlg.cpp; path = ../../src/html/helpdlg.cpp; sourceTree = "<group>"; };
81A30C745CA73E30B788B408 /* image.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = image.cpp; path = ../../src/common/image.cpp; sourceTree = "<group>"; };
@@ -2653,7 +2651,6 @@
5168ADF7BE39351F8F24E1E6 /* cfstring.cpp */,
5BD6231188AB329CAA5E1171 /* evtloop_cf.cpp */,
D5F9383D1CE931499F339D85 /* strconv_cf.cpp */,
81390F96937631078EFCD891 /* utilsexc_base.cpp */,
2ED0C0702D2734D9B08FC31D /* utils_base.mm */,
5BE1FB352696346BB642C045 /* secretstore.cpp */,
47F784C2BB5A3B5DAD276583 /* fdiodispatcher.cpp */,
@@ -2968,7 +2965,6 @@
1DBDF75500D73A3098015E7F /* cfstring.cpp in Sources */,
9FBC642677C63D01AA2511BC /* evtloop_cf.cpp in Sources */,
AAAB5DF8E60736D88273DCFE /* strconv_cf.cpp in Sources */,
4E140367282F38C8A904A004 /* utilsexc_base.cpp in Sources */,
68C300D096BF39239876D043 /* utils_base.mm in Sources */,
B0FD1B96EAE635AFBFCF2C92 /* secretstore.cpp in Sources */,
D36E76A4CAF5352D9397E1FF /* fdiodispatcher.cpp in Sources */,

View File

@@ -28,6 +28,15 @@
#define wxHAS_NSPROCESSINFO 1
#endif
#if wxUSE_SOCKETS
// global pointer which lives in the base library, set from the net one (see
// sockosx.cpp) and used from the GUI code (see utilsexc_cf.cpp) -- ugly but
// needed hack, see the above-mentioned files for more information
class wxSocketManager;
extern WXDLLIMPEXP_BASE wxSocketManager *wxOSXSocketManagerCF;
wxSocketManager *wxOSXSocketManagerCF = NULL;
#endif // wxUSE_SOCKETS
// our OS version is the same in non GUI and GUI cases
wxOperatingSystemId wxGetOsVersion(int *verMaj, int *verMin, int *verMicro)
{

View File

@@ -1,238 +0,0 @@
/////////////////////////////////////////////////////////////////////////////
// Name: src/osx/core/utilsexc_base.cpp
// Purpose: wxMacLaunch
// Author: Ryan Norton
// Modified by:
// Created: 2005-06-21
// Copyright: (c) Ryan Norton
// Licence: wxWindows licence
// Notes: Source was originally in utilsexc_cf.cpp,1.6 then moved
// to totally unrelated hid.cpp,1.8.
/////////////////////////////////////////////////////////////////////////////
//===========================================================================
// DECLARATIONS
//===========================================================================
//---------------------------------------------------------------------------
// Pre-compiled header stuff
//---------------------------------------------------------------------------
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
// WX includes
#ifndef WX_PRECOMP
#include "wx/string.h"
#include "wx/log.h"
#include "wx/intl.h"
#include "wx/utils.h"
#include "wx/wxcrt.h"
#endif // WX_PRECOMP
// Mac Includes
#include <CoreFoundation/CoreFoundation.h>
#ifndef __WXOSX_IPHONE__
#include <ApplicationServices/ApplicationServices.h>
#endif
// More WX Includes
#include "wx/filename.h"
#include "wx/osx/core/cfstring.h"
#include "wx/osx/core/private.h"
#if wxUSE_SOCKETS
// global pointer which lives in the base library, set from the net one (see
// sockosx.cpp) and used from the GUI code (see utilsexc_cf.cpp) -- ugly but
// needed hack, see the above-mentioned files for more information
class wxSocketManager;
extern WXDLLIMPEXP_BASE wxSocketManager *wxOSXSocketManagerCF;
wxSocketManager *wxOSXSocketManagerCF = NULL;
#endif // wxUSE_SOCKETS
#if ( !wxUSE_GUI && !wxOSX_USE_IPHONE ) || wxOSX_USE_COCOA_OR_CARBON
//===========================================================================
// IMPLEMENTATION
//===========================================================================
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//
// wxMacLaunch
//
// argv is the command line split up, with the application path first
// flags are the flags from wxExecute
// process is the process passed from wxExecute for pipe streams etc.
// returns -1 on error for wxEXEC_SYNC and 0 on error for wxEXEC_ASYNC
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
bool wxMacLaunch(const char* const* argv)
{
// Obtains the number of arguments for determining the size of
// the CFArray used to hold them
CFIndex cfiCount = 0;
for (const char* const* argvcopy = argv; *argvcopy != NULL; ++argvcopy)
{
++cfiCount;
}
// If there is not a single argument then there is no application
// to launch
if(cfiCount == 0)
{
wxLogDebug(wxT("wxMacLaunch No file to launch!"));
return false ;
}
// Path to bundle
wxString path = *argv++;
// Create a CFURL for the application path
// Created this way because we are opening a bundle which is a directory
CFURLRef cfurlApp =
CFURLCreateWithFileSystemPath(
kCFAllocatorDefault,
wxCFStringRef(path),
kCFURLPOSIXPathStyle,
true); //false == not a directory
// Check for error from the CFURL
if(!cfurlApp)
{
wxLogDebug(wxT("wxMacLaunch Can't open path: %s"), path.c_str());
return false ;
}
// Create a CFBundle from the CFURL created earlier
CFBundleRef cfbApp = CFBundleCreate(kCFAllocatorDefault, cfurlApp);
// Check to see if CFBundleCreate returned an error,
// and if it did this was an invalid bundle or not a bundle
// at all (maybe a simple directory etc.)
if(!cfbApp)
{
wxLogDebug(wxT("wxMacLaunch Bad bundle: %s"), path.c_str());
CFRelease(cfurlApp);
return false ;
}
// Get the bundle type and make sure its an 'APPL' bundle
// Otherwise we're dealing with something else here...
UInt32 dwBundleType, dwBundleCreator;
CFBundleGetPackageInfo(cfbApp, &dwBundleType, &dwBundleCreator);
if(dwBundleType != 'APPL')
{
wxLogDebug(wxT("wxMacLaunch Not an APPL bundle: %s"), path.c_str());
CFRelease(cfbApp);
CFRelease(cfurlApp);
return false ;
}
// Create a CFArray for dealing with the command line
// arguments to the bundle
CFMutableArrayRef cfaFiles = CFArrayCreateMutable(kCFAllocatorDefault,
cfiCount-1, &kCFTypeArrayCallBacks);
if(!cfaFiles) //This should never happen
{
wxLogDebug(wxT("wxMacLaunch Could not create CFMutableArray"));
CFRelease(cfbApp);
CFRelease(cfurlApp);
return false ;
}
// Loop through command line arguments to the bundle,
// turn them into CFURLs and then put them in cfaFiles
// For use to launch services call
for( ; *argv != NULL ; ++argv)
{
// Check for '<' as this will ring true for
// CFURLCreateWithString but is generally not considered
// typical on mac but is usually passed here from wxExecute
if (wxStrcmp(*argv, wxT("<")) == 0)
continue;
CFURLRef cfurlCurrentFile; // CFURL to hold file path
wxFileName argfn(*argv); // Filename for path
if(argfn.DirExists())
{
// First, try creating as a directory
cfurlCurrentFile = CFURLCreateWithFileSystemPath(
kCFAllocatorDefault,
wxCFStringRef(*argv),
kCFURLPOSIXPathStyle,
true); //true == directory
}
else if(argfn.FileExists())
{
// And if it isn't a directory try creating it
// as a regular file
cfurlCurrentFile = CFURLCreateWithFileSystemPath(
kCFAllocatorDefault,
wxCFStringRef(*argv),
kCFURLPOSIXPathStyle,
false); //false == regular file
}
else
{
// Argument did not refer to
// an entry in the local filesystem,
// so try creating it through CFURLCreateWithString
cfurlCurrentFile = CFURLCreateWithString(
kCFAllocatorDefault,
wxCFStringRef(*argv),
NULL);
}
// Continue in the loop if the CFURL could not be created
if(!cfurlCurrentFile)
{
wxLogDebug(
wxT("wxMacLaunch Could not create CFURL for argument:%s"),
*argv);
continue;
}
// Add the valid CFURL to the argument array and then
// release it as the CFArray adds a ref count to it
CFArrayAppendValue(
cfaFiles,
cfurlCurrentFile
);
CFRelease(cfurlCurrentFile); // array has retained it
}
// Create a LSLaunchURLSpec for use with LSOpenFromURLSpec
// Note that there are several flag options (launchFlags) such
// as kLSLaunchDontSwitch etc. and maybe we could be more
// picky about the flags we choose
LSLaunchURLSpec launchspec;
launchspec.appURL = cfurlApp;
launchspec.itemURLs = cfaFiles;
launchspec.passThruParams = NULL; //AEDesc*
launchspec.launchFlags = kLSLaunchDefaults;
launchspec.asyncRefCon = NULL;
// Finally, call LSOpenFromURL spec with our arguments
// 2nd parameter is a pointer to a CFURL that gets
// the actual path launched by the function
OSStatus status = LSOpenFromURLSpec(&launchspec, NULL);
// Cleanup corefoundation references
CFRelease(cfbApp);
CFRelease(cfurlApp);
CFRelease(cfaFiles);
// Check for error from LSOpenFromURLSpec
if(status != noErr)
{
wxLogDebug(wxT("wxMacLaunch LSOpenFromURLSpec Error: %d"),
(int)status);
return false ;
}
// No error from LSOpenFromURLSpec, so app was launched
return true ;
}
#endif // wxOSX_USE_COCOA_OR_CARBON

View File

@@ -1120,7 +1120,7 @@ wxLinuxDistributionInfo wxGetLinuxDistributionInfo()
}
#endif // __LINUX__
// these functions are in src/osx/utilsexc_base.cpp for wxMac
// these functions are in src/osx/utils_base.mm for wxOSX.
#ifndef __DARWIN__
wxOperatingSystemId wxGetOsVersion(int *verMaj, int *verMin, int *verMicro)