]> git.saurik.com Git - wxWidgets.git/blobdiff - src/mac/corefoundation/stdpaths_cf.cpp
OSX two-level header fixes
[wxWidgets.git] / src / mac / corefoundation / stdpaths_cf.cpp
index f38c5a72109b8d82590d787b4b0eb738a6bf7a43..20f2c8cf3a6b3362ca5771dba2aa1c135bfaa556 100644 (file)
@@ -10,6 +10,9 @@
 ///////////////////////////////////////////////////////////////////////////////
 
 #include "wx/wxprec.h"
+
+#if wxUSE_STDPATHS
+
 #ifndef WX_PRECOMP
     #include "wx/intl.h"
 #endif //ndef WX_PRECOMP
 #include "wx/filename.h"
 #include "wx/mac/corefoundation/cfstring.h"
 
+#if defined(__DARWIN__)
 #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."
+#else
+#include <CFBundle.h>
+#include <CFURL.h>
 #endif
 
 #if defined(__WXCOCOA__) || defined(__WXMAC_OSX__)
@@ -41,50 +44,43 @@ static wxString BundleRelativeURLToPath(CFURLRef relativeURL)
     return wxMacCFStringHolder(cfStrPath).AsString(wxLocale::GetSystemEncoding());
 }
 
-
-static wxStandardPaths gs_stdPaths;
-/* static */ wxStandardPaths& wxStandardPaths::Get()
-{
-    return gs_stdPaths;
-}
-
-wxStandardPaths::wxStandardPaths()
+wxStandardPathsCF::wxStandardPathsCF()
 :   m_bundle(CFBundleGetMainBundle())
 {
     CFRetain(m_bundle);
 }
 
-wxStandardPaths::wxStandardPaths(struct __CFBundle *bundle)
+wxStandardPathsCF::wxStandardPathsCF(struct __CFBundle *bundle)
 :   m_bundle(bundle)
 {
     CFRetain(m_bundle);
 }
 
-wxStandardPaths::~wxStandardPaths()
+wxStandardPathsCF::~wxStandardPathsCF()
 {
     CFRelease(m_bundle);
 }
 
-void wxStandardPaths::SetBundle(struct __CFBundle *bundle)
+void wxStandardPathsCF::SetBundle(struct __CFBundle *bundle)
 {
     CFRetain(bundle);
     CFRelease(m_bundle);
     m_bundle = bundle;
 }
 
-wxString wxStandardPaths::GetConfigDir() const
+wxString wxStandardPathsCF::GetConfigDir() const
 {
     // TODO: What do we do for pure Carbon?
     return wxT("/Library/Preferences");
 }
 
-wxString wxStandardPaths::GetUserConfigDir() const
+wxString wxStandardPathsCF::GetUserConfigDir() const
 {
     // TODO: What do we do for pure Carbon?
     return wxFileName::GetHomeDir() + wxT("/Library/Preferences");
 }
 
-wxString wxStandardPaths::GetDataDir() const
+wxString wxStandardPathsCF::GetDataDir() const
 {
     wxCHECK_MSG(m_bundle, wxEmptyString, wxT("wxStandardPaths for CoreFoundation only works with bundled apps"));
     CFURLRef relativeURL = CFBundleCopySharedSupportURL(m_bundle);
@@ -94,17 +90,17 @@ wxString wxStandardPaths::GetDataDir() const
     return ret;
 }
 
-wxString wxStandardPaths::GetLocalDataDir() const
+wxString wxStandardPathsCF::GetLocalDataDir() const
 {
     return AppendAppName(wxT("/Library/Application Support"));
 }
 
-wxString wxStandardPaths::GetUserDataDir() const
+wxString wxStandardPathsCF::GetUserDataDir() const
 {
     return AppendAppName(wxFileName::GetHomeDir() + _T("/Library/Application Support"));
 }
 
-wxString wxStandardPaths::GetPluginsDir() const
+wxString wxStandardPathsCF::GetPluginsDir() const
 {
     wxCHECK_MSG(m_bundle, wxEmptyString, wxT("wxStandardPaths for CoreFoundation only works with bundled apps"));
     CFURLRef relativeURL = CFBundleCopyBuiltInPlugInsURL(m_bundle);
@@ -114,3 +110,4 @@ wxString wxStandardPaths::GetPluginsDir() const
     return ret;
 }
 
+#endif // wxUSE_STDPATHS