Added wxStandardPaths for wxMac and wxCocoa.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@30174 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
58
Makefile.in
58
Makefile.in
@@ -420,6 +420,7 @@ ALL_BASE_SOURCES = \
|
||||
src/mac/carbon/macnotfy.cpp \
|
||||
src/mac/carbon/morefilex/MoreFilesX.c \
|
||||
src/mac/corefoundation/cfstring.cpp \
|
||||
src/mac/corefoundation/stdpaths_cf.cpp \
|
||||
src/os2/dir.cpp \
|
||||
src/os2/mimetype.cpp \
|
||||
src/os2/thread.cpp \
|
||||
@@ -1211,8 +1212,10 @@ COND_TOOLKIT_COCOA_BASE_PLATFORM_HDR = \
|
||||
wx/unix/pipe.h \
|
||||
wx/unix/stdpaths.h
|
||||
@COND_TOOLKIT_COCOA@BASE_PLATFORM_HDR = $(COND_TOOLKIT_COCOA_BASE_PLATFORM_HDR)
|
||||
@COND_TOOLKIT_MAC@BASE_PLATFORM_HDR = \
|
||||
@COND_TOOLKIT_MAC@ include/wx/mac/corefoundation/cfstring.h
|
||||
COND_TOOLKIT_MAC_BASE_PLATFORM_HDR = \
|
||||
include/wx/mac/corefoundation/cfstring.h \
|
||||
include/wx/mac/corefoundation/stdpaths.h
|
||||
@COND_TOOLKIT_MAC@BASE_PLATFORM_HDR = $(COND_TOOLKIT_MAC_BASE_PLATFORM_HDR)
|
||||
@COND_PLATFORM_MACOSX_1@NET_PLATFORM_HDR = wx/unix/gsockunx.h
|
||||
@COND_PLATFORM_OS2_1@NET_PLATFORM_HDR = wx/unix/gsockunx.h
|
||||
@COND_PLATFORM_UNIX_1@NET_PLATFORM_HDR = wx/unix/gsockunx.h
|
||||
@@ -1408,7 +1411,8 @@ COND_TOOLKIT_COCOA_GUI_HDR = \
|
||||
wx/generic/region.h \
|
||||
wx/generic/statusbr.h \
|
||||
wx/generic/tabg.h \
|
||||
include/wx/mac/corefoundation/cfstring.h
|
||||
include/wx/mac/corefoundation/cfstring.h \
|
||||
include/wx/mac/corefoundation/stdpaths.h
|
||||
@COND_TOOLKIT_COCOA@GUI_HDR = $(COND_TOOLKIT_COCOA_GUI_HDR)
|
||||
COND_TOOLKIT_GTK_GUI_HDR = \
|
||||
wx/generic/colrdlgg.h \
|
||||
@@ -2457,7 +2461,8 @@ COND_TOOLKIT_MAC___BASE_MACOSX_SRC_OBJECTS = \
|
||||
monodll_thread.o \
|
||||
monodll_macnotfy.o \
|
||||
monodll_MoreFilesX.o \
|
||||
monodll_cfstring.o
|
||||
monodll_cfstring.o \
|
||||
monodll_stdpaths_cf.o
|
||||
@COND_TOOLKIT_MAC@__BASE_MACOSX_SRC_OBJECTS = $(COND_TOOLKIT_MAC___BASE_MACOSX_SRC_OBJECTS)
|
||||
COND_TOOLKIT_MOTIF___BASE_MACOSX_SRC_OBJECTS = \
|
||||
monodll_baseunix.o \
|
||||
@@ -2905,7 +2910,8 @@ COND_TOOLKIT_COCOA___GUI_SRC_OBJECTS = \
|
||||
monodll_tabg.o \
|
||||
monodll_timer.o \
|
||||
monodll_gsockosx.o \
|
||||
monodll_cfstring.o
|
||||
monodll_cfstring.o \
|
||||
monodll_stdpaths_cf.o
|
||||
@COND_TOOLKIT_COCOA@__GUI_SRC_OBJECTS = $(COND_TOOLKIT_COCOA___GUI_SRC_OBJECTS)
|
||||
COND_TOOLKIT_GTK___GUI_SRC_OBJECTS = \
|
||||
monodll_accel.o \
|
||||
@@ -3408,7 +3414,8 @@ COND_TOOLKIT_MAC___BASE_MACOSX_SRC_OBJECTS_1 = \
|
||||
monolib_thread.o \
|
||||
monolib_macnotfy.o \
|
||||
monolib_MoreFilesX.o \
|
||||
monolib_cfstring.o
|
||||
monolib_cfstring.o \
|
||||
monolib_stdpaths_cf.o
|
||||
@COND_TOOLKIT_MAC@__BASE_MACOSX_SRC_OBJECTS_1 = $(COND_TOOLKIT_MAC___BASE_MACOSX_SRC_OBJECTS_1)
|
||||
COND_TOOLKIT_MOTIF___BASE_MACOSX_SRC_OBJECTS_1 = \
|
||||
monolib_baseunix.o \
|
||||
@@ -3856,7 +3863,8 @@ COND_TOOLKIT_COCOA___GUI_SRC_OBJECTS_1 = \
|
||||
monolib_tabg.o \
|
||||
monolib_timer.o \
|
||||
monolib_gsockosx.o \
|
||||
monolib_cfstring.o
|
||||
monolib_cfstring.o \
|
||||
monolib_stdpaths_cf.o
|
||||
@COND_TOOLKIT_COCOA@__GUI_SRC_OBJECTS_1 = $(COND_TOOLKIT_COCOA___GUI_SRC_OBJECTS_1)
|
||||
COND_TOOLKIT_GTK___GUI_SRC_OBJECTS_1 = \
|
||||
monolib_accel.o \
|
||||
@@ -4394,7 +4402,8 @@ COND_TOOLKIT_MAC___BASE_MACOSX_SRC_OBJECTS_2 = \
|
||||
basedll_thread.o \
|
||||
basedll_macnotfy.o \
|
||||
basedll_MoreFilesX.o \
|
||||
basedll_cfstring.o
|
||||
basedll_cfstring.o \
|
||||
basedll_stdpaths_cf.o
|
||||
@COND_TOOLKIT_MAC@__BASE_MACOSX_SRC_OBJECTS_2 = $(COND_TOOLKIT_MAC___BASE_MACOSX_SRC_OBJECTS_2)
|
||||
COND_TOOLKIT_MOTIF___BASE_MACOSX_SRC_OBJECTS_2 = \
|
||||
basedll_baseunix.o \
|
||||
@@ -4491,7 +4500,8 @@ COND_TOOLKIT_MAC___BASE_MACOSX_SRC_OBJECTS_3 = \
|
||||
baselib_thread.o \
|
||||
baselib_macnotfy.o \
|
||||
baselib_MoreFilesX.o \
|
||||
baselib_cfstring.o
|
||||
baselib_cfstring.o \
|
||||
baselib_stdpaths_cf.o
|
||||
@COND_TOOLKIT_MAC@__BASE_MACOSX_SRC_OBJECTS_3 = $(COND_TOOLKIT_MAC___BASE_MACOSX_SRC_OBJECTS_3)
|
||||
COND_TOOLKIT_MOTIF___BASE_MACOSX_SRC_OBJECTS_3 = \
|
||||
baselib_baseunix.o \
|
||||
@@ -4968,7 +4978,8 @@ COND_TOOLKIT_COCOA___GUI_SRC_OBJECTS_2 = \
|
||||
coredll_tabg.o \
|
||||
coredll_timer.o \
|
||||
coredll_gsockosx.o \
|
||||
coredll_cfstring.o
|
||||
coredll_cfstring.o \
|
||||
coredll_stdpaths_cf.o
|
||||
@COND_TOOLKIT_COCOA@__GUI_SRC_OBJECTS_2 = $(COND_TOOLKIT_COCOA___GUI_SRC_OBJECTS_2)
|
||||
COND_TOOLKIT_GTK___GUI_SRC_OBJECTS_2 = \
|
||||
coredll_accel.o \
|
||||
@@ -5712,7 +5723,8 @@ COND_TOOLKIT_COCOA___GUI_SRC_OBJECTS_3 = \
|
||||
corelib_tabg.o \
|
||||
corelib_timer.o \
|
||||
corelib_gsockosx.o \
|
||||
corelib_cfstring.o
|
||||
corelib_cfstring.o \
|
||||
corelib_stdpaths_cf.o
|
||||
@COND_TOOLKIT_COCOA@__GUI_SRC_OBJECTS_3 = $(COND_TOOLKIT_COCOA___GUI_SRC_OBJECTS_3)
|
||||
COND_TOOLKIT_GTK___GUI_SRC_OBJECTS_3 = \
|
||||
corelib_accel.o \
|
||||
@@ -9242,6 +9254,12 @@ monodll_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONODLL_ODEP)
|
||||
@COND_TOOLKIT_COCOA_USE_GUI_1_WXUNIV_0@monodll_cfstring.o: $(srcdir)/src/mac/corefoundation/cfstring.cpp $(MONODLL_ODEP)
|
||||
@COND_TOOLKIT_COCOA_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $<
|
||||
|
||||
@COND_PLATFORM_MACOSX_1_TOOLKIT_MAC@monodll_stdpaths_cf.o: $(srcdir)/src/mac/corefoundation/stdpaths_cf.cpp $(MONODLL_ODEP)
|
||||
@COND_PLATFORM_MACOSX_1_TOOLKIT_MAC@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $<
|
||||
|
||||
@COND_TOOLKIT_COCOA_USE_GUI_1_WXUNIV_0@monodll_stdpaths_cf.o: $(srcdir)/src/mac/corefoundation/stdpaths_cf.cpp $(MONODLL_ODEP)
|
||||
@COND_TOOLKIT_COCOA_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $<
|
||||
|
||||
@COND_PLATFORM_UNIX_1@monodll_utilsunx.o: $(srcdir)/src/unix/utilsunx.cpp $(MONODLL_ODEP)
|
||||
@COND_PLATFORM_UNIX_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $<
|
||||
|
||||
@@ -12452,6 +12470,12 @@ monolib_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONOLIB_ODEP)
|
||||
@COND_TOOLKIT_COCOA_USE_GUI_1_WXUNIV_0@monolib_cfstring.o: $(srcdir)/src/mac/corefoundation/cfstring.cpp $(MONOLIB_ODEP)
|
||||
@COND_TOOLKIT_COCOA_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $<
|
||||
|
||||
@COND_PLATFORM_MACOSX_1_TOOLKIT_MAC@monolib_stdpaths_cf.o: $(srcdir)/src/mac/corefoundation/stdpaths_cf.cpp $(MONOLIB_ODEP)
|
||||
@COND_PLATFORM_MACOSX_1_TOOLKIT_MAC@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $<
|
||||
|
||||
@COND_TOOLKIT_COCOA_USE_GUI_1_WXUNIV_0@monolib_stdpaths_cf.o: $(srcdir)/src/mac/corefoundation/stdpaths_cf.cpp $(MONOLIB_ODEP)
|
||||
@COND_TOOLKIT_COCOA_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $<
|
||||
|
||||
@COND_PLATFORM_UNIX_1@monolib_utilsunx.o: $(srcdir)/src/unix/utilsunx.cpp $(MONOLIB_ODEP)
|
||||
@COND_PLATFORM_UNIX_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $<
|
||||
|
||||
@@ -15029,6 +15053,9 @@ basedll_MoreFilesX.o: $(srcdir)/src/mac/carbon/morefilex/MoreFilesX.c $(BASEDLL_
|
||||
basedll_cfstring.o: $(srcdir)/src/mac/corefoundation/cfstring.cpp $(BASEDLL_ODEP)
|
||||
$(CXXC) -c -o $@ $(BASEDLL_CXXFLAGS) $<
|
||||
|
||||
basedll_stdpaths_cf.o: $(srcdir)/src/mac/corefoundation/stdpaths_cf.cpp $(BASEDLL_ODEP)
|
||||
$(CXXC) -c -o $@ $(BASEDLL_CXXFLAGS) $<
|
||||
|
||||
basedll_event.o: $(srcdir)/src/common/event.cpp $(BASEDLL_ODEP)
|
||||
$(CXXC) -c -o $@ $(BASEDLL_CXXFLAGS) $<
|
||||
|
||||
@@ -15410,6 +15437,9 @@ baselib_MoreFilesX.o: $(srcdir)/src/mac/carbon/morefilex/MoreFilesX.c $(BASELIB_
|
||||
baselib_cfstring.o: $(srcdir)/src/mac/corefoundation/cfstring.cpp $(BASELIB_ODEP)
|
||||
$(CXXC) -c -o $@ $(BASELIB_CXXFLAGS) $<
|
||||
|
||||
baselib_stdpaths_cf.o: $(srcdir)/src/mac/corefoundation/stdpaths_cf.cpp $(BASELIB_ODEP)
|
||||
$(CXXC) -c -o $@ $(BASELIB_CXXFLAGS) $<
|
||||
|
||||
baselib_event.o: $(srcdir)/src/common/event.cpp $(BASELIB_ODEP)
|
||||
$(CXXC) -c -o $@ $(BASELIB_CXXFLAGS) $<
|
||||
|
||||
@@ -15842,6 +15872,9 @@ coredll_regiong.o: $(srcdir)/src/generic/regiong.cpp $(COREDLL_ODEP)
|
||||
coredll_cfstring.o: $(srcdir)/src/mac/corefoundation/cfstring.cpp $(COREDLL_ODEP)
|
||||
$(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $<
|
||||
|
||||
coredll_stdpaths_cf.o: $(srcdir)/src/mac/corefoundation/stdpaths_cf.cpp $(COREDLL_ODEP)
|
||||
$(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $<
|
||||
|
||||
coredll_gsockpm.o: $(srcdir)/src/os2/gsockpm.cpp $(COREDLL_ODEP)
|
||||
$(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $<
|
||||
|
||||
@@ -18329,6 +18362,9 @@ corelib_regiong.o: $(srcdir)/src/generic/regiong.cpp $(CORELIB_ODEP)
|
||||
corelib_cfstring.o: $(srcdir)/src/mac/corefoundation/cfstring.cpp $(CORELIB_ODEP)
|
||||
$(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $<
|
||||
|
||||
corelib_stdpaths_cf.o: $(srcdir)/src/mac/corefoundation/stdpaths_cf.cpp $(CORELIB_ODEP)
|
||||
$(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $<
|
||||
|
||||
corelib_gsockpm.o: $(srcdir)/src/os2/gsockpm.cpp $(CORELIB_ODEP)
|
||||
$(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $<
|
||||
|
||||
|
@@ -108,7 +108,9 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
|
||||
src/mac/carbon/thread.cpp
|
||||
src/mac/carbon/macnotfy.cpp
|
||||
src/mac/carbon/morefilex/MoreFilesX.c
|
||||
<!-- Shared wxMac and wxCocoa files -->
|
||||
src/mac/corefoundation/cfstring.cpp
|
||||
src/mac/corefoundation/stdpaths_cf.cpp
|
||||
</set>
|
||||
|
||||
<set var="BASE_AND_GUI_MAC_SRC" hints="files">
|
||||
@@ -117,7 +119,9 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
|
||||
</set>
|
||||
|
||||
<set var="BASE_MAC_HDR" hints="files">
|
||||
<!-- Shared wxMac and wxCocoa files -->
|
||||
include/wx/mac/corefoundation/cfstring.h
|
||||
include/wx/mac/corefoundation/stdpaths.h
|
||||
</set>
|
||||
|
||||
<set var="BASE_OS2_SRC" hints="files">
|
||||
@@ -1945,6 +1949,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
|
||||
src/mac/carbon/gsockosx.cpp
|
||||
<!-- Shared wxMac and wxCocoa files -->
|
||||
src/mac/corefoundation/cfstring.cpp
|
||||
src/mac/corefoundation/stdpaths_cf.cpp
|
||||
</set>
|
||||
<set var="COCOA_HDR" hints="files">
|
||||
wx/cocoa/NSApplication.h
|
||||
@@ -2030,6 +2035,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
|
||||
wx/generic/tabg.h
|
||||
<!-- Shared wxMac and wxCocoa files -->
|
||||
include/wx/mac/corefoundation/cfstring.h
|
||||
include/wx/mac/corefoundation/stdpaths.h
|
||||
</set>
|
||||
|
||||
|
||||
|
55
include/wx/mac/corefoundation/stdpaths.h
Normal file
55
include/wx/mac/corefoundation/stdpaths.h
Normal file
@@ -0,0 +1,55 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/mac/corefoundation/stdpaths.h
|
||||
// Purpose: wxStandardPaths for CoreFoundation systems
|
||||
// Author: David Elliott
|
||||
// Modified by:
|
||||
// Created: 2004-10-27
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 2004 David Elliott
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_MAC_STDPATHS_H_
|
||||
#define _WX_MAC_STDPATHS_H_
|
||||
|
||||
struct __CFBundle;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxStandardPaths
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLIMPEXP_BASE wxStandardPathsCF : public wxStandardPathsBase
|
||||
{
|
||||
public:
|
||||
wxStandardPathsCF();
|
||||
~wxStandardPathsCF();
|
||||
|
||||
// return the global standard paths object
|
||||
// Overrides wxStandardPathsBase version for GUI code.
|
||||
static wxStandardPathsCF& Get();
|
||||
|
||||
// wxMac specific: allow user to specify a different bundle
|
||||
wxStandardPathsCF(struct __CFBundle *bundle);
|
||||
void SetBundle(struct __CFBundle *bundle);
|
||||
|
||||
// implement base class pure virtuals
|
||||
virtual wxString GetConfigDir() const;
|
||||
virtual wxString GetUserConfigDir() const;
|
||||
virtual wxString GetDataDir() const;
|
||||
virtual wxString GetLocalDataDir() const;
|
||||
virtual wxString GetUserDataDir() const;
|
||||
virtual wxString GetPluginsDir() const;
|
||||
protected:
|
||||
struct __CFBundle *m_bundle;
|
||||
};
|
||||
|
||||
// wxMac has its own base so it always uses this version.
|
||||
// Otherwise, we want to use this version only when compiling GUI code.
|
||||
// The CoreFoundation version is always available by its full name to all code.
|
||||
#if defined(__WXMAC__) || wxUSE_BASE == 0
|
||||
#define wxStandardPaths wxStandardPathsCF
|
||||
#else
|
||||
#include "wx/unix/stdpaths.h"
|
||||
#endif
|
||||
|
||||
#endif // _WX_MAC_STDPATHS_H_
|
@@ -84,8 +84,8 @@ protected:
|
||||
|
||||
#if defined(__WXMSW__)
|
||||
#include "wx/msw/stdpaths.h"
|
||||
#elif defined(__WXMAC_OSX__) || defined(__WXCOCOA__)
|
||||
#include "wx/mac/stdpaths.h"
|
||||
#elif defined(__WXMAC__) || defined(__WXCOCOA__)
|
||||
#include "wx/mac/corefoundation/stdpaths.h"
|
||||
#elif defined(__UNIX__)
|
||||
#include "wx/unix/stdpaths.h"
|
||||
#endif
|
||||
|
@@ -24,9 +24,6 @@
|
||||
#pragma hdrstop
|
||||
#endif
|
||||
|
||||
// FIXME: there is no Mac implementation yet
|
||||
#ifndef __WXMAC__
|
||||
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/app.h"
|
||||
#endif //WX_PRECOMP
|
||||
@@ -87,5 +84,3 @@ wxString wxStandardPathsBase::AppendAppName(const wxString& dir)
|
||||
return subdir;
|
||||
}
|
||||
|
||||
#endif // !__WXMAC__
|
||||
|
||||
|
116
src/mac/corefoundation/stdpaths_cf.cpp
Normal file
116
src/mac/corefoundation/stdpaths_cf.cpp
Normal file
@@ -0,0 +1,116 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: mac/corefoundation/stdpaths.cpp
|
||||
// Purpose: wxStandardPaths implementation for CoreFoundation systems
|
||||
// Author: David Elliott
|
||||
// Modified by:
|
||||
// Created: 2004-10-27
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 2004 David Elliott <dfe@cox.net>
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "wx/wxprec.h"
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/intl.h"
|
||||
#endif //ndef WX_PRECOMP
|
||||
|
||||
#include "wx/stdpaths.h"
|
||||
#include "wx/filename.h"
|
||||
#include "wx/mac/corefoundation/cfstring.h"
|
||||
|
||||
#include <CoreFoundation/CFBundle.h>
|
||||
#include <CoreFoundation/CFURL.h>
|
||||
|
||||
// See comment in include/wx/mac/corefoundation/stdpaths.h
|
||||
#ifndef wxStandardPaths
|
||||
#warning "wxStandardPaths should be defined to wxStandardPathsCF when compiling this file."
|
||||
#endif
|
||||
|
||||
#if defined(__WXCOCOA__) || defined(__WXMAC_OSX__)
|
||||
#define kDefaultPathStyle kCFURLPOSIXPathStyle
|
||||
#else
|
||||
#define kDefaultPathStyle kCFURLHFSPathStyle
|
||||
#endif
|
||||
|
||||
static wxString BundleRelativeURLToPath(CFURLRef relativeURL)
|
||||
{
|
||||
CFURLRef absoluteURL = CFURLCopyAbsoluteURL(relativeURL);
|
||||
wxCHECK_MSG(absoluteURL, wxEmptyString, wxT("Failed to resolve relative URL to absolute URL"));
|
||||
CFStringRef cfStrPath = CFURLCopyFileSystemPath(absoluteURL,kDefaultPathStyle);
|
||||
CFRelease(absoluteURL);
|
||||
return wxMacCFStringHolder(cfStrPath).AsString(wxLocale::GetSystemEncoding());
|
||||
}
|
||||
|
||||
|
||||
static wxStandardPaths gs_stdPaths;
|
||||
/* static */ wxStandardPaths& wxStandardPaths::Get()
|
||||
{
|
||||
return gs_stdPaths;
|
||||
}
|
||||
|
||||
wxStandardPaths::wxStandardPaths()
|
||||
: m_bundle(CFBundleGetMainBundle())
|
||||
{
|
||||
CFRetain(m_bundle);
|
||||
}
|
||||
|
||||
wxStandardPaths::wxStandardPaths(struct __CFBundle *bundle)
|
||||
: m_bundle(bundle)
|
||||
{
|
||||
CFRetain(m_bundle);
|
||||
}
|
||||
|
||||
wxStandardPaths::~wxStandardPaths()
|
||||
{
|
||||
CFRelease(m_bundle);
|
||||
}
|
||||
|
||||
void wxStandardPaths::SetBundle(struct __CFBundle *bundle)
|
||||
{
|
||||
CFRetain(bundle);
|
||||
CFRelease(m_bundle);
|
||||
m_bundle = bundle;
|
||||
}
|
||||
|
||||
wxString wxStandardPaths::GetConfigDir() const
|
||||
{
|
||||
// TODO: What do we do for pure Carbon?
|
||||
return wxT("/Library/Preferences");
|
||||
}
|
||||
|
||||
wxString wxStandardPaths::GetUserConfigDir() const
|
||||
{
|
||||
// TODO: What do we do for pure Carbon?
|
||||
return wxFileName::GetHomeDir() + wxT("/Library/Preferences");
|
||||
}
|
||||
|
||||
wxString wxStandardPaths::GetDataDir() const
|
||||
{
|
||||
wxCHECK_MSG(m_bundle, wxEmptyString, wxT("wxStandardPaths for CoreFoundation only works with bundled apps"));
|
||||
CFURLRef relativeURL = CFBundleCopySharedSupportURL(m_bundle);
|
||||
wxCHECK_MSG(relativeURL, wxEmptyString, wxT("Couldn't get SharedSupport URL"));
|
||||
wxString ret(BundleRelativeURLToPath(relativeURL));
|
||||
CFRelease(relativeURL);
|
||||
return ret;
|
||||
}
|
||||
|
||||
wxString wxStandardPaths::GetLocalDataDir() const
|
||||
{
|
||||
return AppendAppName(wxT("/Library/Application Support"));
|
||||
}
|
||||
|
||||
wxString wxStandardPaths::GetUserDataDir() const
|
||||
{
|
||||
return AppendAppName(wxFileName::GetHomeDir() + _T("/Library/Application Support"));
|
||||
}
|
||||
|
||||
wxString wxStandardPaths::GetPluginsDir() const
|
||||
{
|
||||
wxCHECK_MSG(m_bundle, wxEmptyString, wxT("wxStandardPaths for CoreFoundation only works with bundled apps"));
|
||||
CFURLRef relativeURL = CFBundleCopyBuiltInPlugInsURL(m_bundle);
|
||||
wxCHECK_MSG(relativeURL, wxEmptyString, wxT("Couldn't get BuiltInPlugIns URL"));
|
||||
wxString ret(BundleRelativeURLToPath(relativeURL));
|
||||
CFRelease(relativeURL);
|
||||
return ret;
|
||||
}
|
||||
|
Reference in New Issue
Block a user