]> git.saurik.com Git - wxWidgets.git/blobdiff - src/mac/corefoundation/stdpaths_cf.cpp
correction to last commit: don't test unsetenv() return value, it's void under Darwin
[wxWidgets.git] / src / mac / corefoundation / stdpaths_cf.cpp
index eb6e0367bf9ed7446a13d9bd464d6a94a8a3beb9..f8cf48355a0e118d378c02458134914f4698ab48 100644 (file)
@@ -106,6 +106,24 @@ wxString wxStandardPathsCF::GetFromFunc(wxCFURLRef (*func)(wxCFBundleRef)) const
     return ret;
 }
 
+wxString wxStandardPathsCF::GetDocumentsDir() const
+{
+#ifdef __WXMAC__
+    return wxMacFindFolderNoSeparator
+        (
+#if TARGET_API_MAC_OSX
+        kUserDomain,
+#else
+        kOnSystemDisk,
+#endif
+        kDocumentsFolderType,
+        kCreateFolder
+        );
+#else
+    return wxFileName::GetHomeDir() + wxT("/Documents");
+#endif
+}
+
 // ----------------------------------------------------------------------------
 // wxStandardPathsCF public API
 // ----------------------------------------------------------------------------
@@ -133,6 +151,27 @@ wxString wxStandardPathsCF::GetDataDir() const
     return GetFromFunc(CFBundleCopySharedSupportURL);
 }
 
+// TODO: implement this using real CoreFoundation API instead of Carbon API
+wxString wxStandardPathsCF::GetExecutablePath() const
+{
+#ifdef __WXMAC__
+    ProcessInfoRec processinfo;
+    ProcessSerialNumber procno ;
+    FSSpec fsSpec;
+
+    procno.highLongOfPSN = 0 ;
+    procno.lowLongOfPSN = kCurrentProcess ;
+    processinfo.processInfoLength = sizeof(ProcessInfoRec);
+    processinfo.processName = NULL;
+    processinfo.processAppSpec = &fsSpec;
+
+    GetProcessInformation( &procno , &processinfo ) ;
+    return wxMacFSSpec2MacFilename(&fsSpec);
+#else
+    return wxStandardPathsBase::GetExecutablePath();
+#endif
+}
+
 wxString wxStandardPathsCF::GetLocalDataDir() const
 {
 #ifdef __WXMAC__
@@ -162,7 +201,7 @@ wxString wxStandardPathsCF::GetResourcesDir() const
 }
 
 wxString
-wxStandardPathsCF::GetLocalizedResourcesDir(const wxChar *lang,
+wxStandardPathsCF::GetLocalizedResourcesDir(const wxString& lang,
                                             ResourceCat category) const
 {
     return wxStandardPathsBase::