switch to cf implementation

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@50109 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Csomor
2007-11-20 16:07:43 +00:00
parent c944775f72
commit 0aa6452b9d

View File

@@ -104,11 +104,7 @@ wxString wxStandardPathsCF::GetDocumentsDir() const
#ifdef __WXMAC__ #ifdef __WXMAC__
return wxMacFindFolderNoSeparator return wxMacFindFolderNoSeparator
( (
#if TARGET_API_MAC_OSX
kUserDomain, kUserDomain,
#else
kOnSystemDisk,
#endif
kDocumentsFolderType, kDocumentsFolderType,
kCreateFolder kCreateFolder
); );
@@ -144,26 +140,39 @@ wxString wxStandardPathsCF::GetDataDir() const
return GetFromFunc(CFBundleCopySharedSupportURL); return GetFromFunc(CFBundleCopySharedSupportURL);
} }
// TODO: implement this using real CoreFoundation API instead of Carbon API
wxString wxStandardPathsCF::GetExecutablePath() const wxString wxStandardPathsCF::GetExecutablePath() const
{ {
#ifdef __WXMAC__ #ifdef __WXMAC__
#if 1
return GetFromFunc(CFBundleCopyBundleURL);
#else
// TODO remove if cf implementation ok
ProcessInfoRec processinfo; ProcessInfoRec processinfo;
ProcessSerialNumber procno ; ProcessSerialNumber procno ;
#ifdef __LP64__
FSRef fsRef;
#else
FSSpec fsSpec; FSSpec fsSpec;
#endif
procno.highLongOfPSN = 0 ; procno.highLongOfPSN = 0 ;
procno.lowLongOfPSN = kCurrentProcess ; procno.lowLongOfPSN = kCurrentProcess ;
processinfo.processInfoLength = sizeof(ProcessInfoRec); processinfo.processInfoLength = sizeof(ProcessInfoRec);
processinfo.processName = NULL; processinfo.processName = NULL;
#ifdef __LP64__
processinfo.processAppRef = &fsRef;
#else
processinfo.processAppSpec = &fsSpec; processinfo.processAppSpec = &fsSpec;
#endif
GetProcessInformation( &procno , &processinfo ) ; GetProcessInformation( &procno , &processinfo ) ;
#ifdef __LP64__ #ifdef __LP64__
return wxMacFSRefToPath(&fsRef); return wxMacFSRefToPath(&fsRef);
#else #else
return wxMacFSSpec2MacFilename(&fsSpec); return wxMacFSSpec2MacFilename(&fsSpec);
#endif #endif
#endif
#else #else
return wxStandardPathsBase::GetExecutablePath(); return wxStandardPathsBase::GetExecutablePath();
#endif #endif