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 \
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
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 \
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 \
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 \
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 \
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 \
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 \
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 \
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 \
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 \
@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) $<
@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) $<
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) $<
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) $<
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) $<
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) $<
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">
</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">
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
wx/generic/tabg.h
<!-- Shared wxMac and wxCocoa files -->
include/wx/mac/corefoundation/cfstring.h
+ include/wx/mac/corefoundation/stdpaths.h
</set>
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// 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_
#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
#pragma hdrstop
#endif
-// FIXME: there is no Mac implementation yet
-#ifndef __WXMAC__
-
#ifndef WX_PRECOMP
#include "wx/app.h"
#endif //WX_PRECOMP
return subdir;
}
-#endif // !__WXMAC__
-
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// 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;
+}
+