|
From: creedon <icr...@us...> - 2005-07-18 00:17:00
|
Update of /cvsroot/frontierkernel/Frontier/Common/source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25824 Modified Files: filepath.c Log Message: pathtofilespec - don't use FSMakeFSSpec to fill in default directory and volume, see < http://developer.apple.com/technotes/tn/tn2015.html >, not sure if this is best place to do this, seems like it might be better handled at application launch Index: filepath.c =================================================================== RCS file: /cvsroot/frontierkernel/Frontier/Common/source/filepath.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** filepath.c 11 Jan 2005 22:48:05 -0000 1.4 --- filepath.c 18 Jul 2005 00:16:48 -0000 1.5 *************** *** 35,48 **** #include "file.h" - - #define flaux false /*if true, we're running under the A/UX operating system*/ - #ifdef MACVERSION ! static FSSpec fsdefault = {0}; /*we maintain our own default directory*/ ! ! boolean directorytopath (long DirID, short vnum, bigstring path) { --- 35,43 ---- #include "file.h" #define flaux false /*if true, we're running under the A/UX operating system*/ #ifdef MACVERSION ! static FSSpec fsdefault; // = {0}; /*we maintain our own default directory*/ boolean directorytopath (long DirID, short vnum, bigstring path) { *************** *** 256,260 **** return (true); ! #ifdef MACVERSION errcode = FSMakeFSSpec (fsdefault.vRefNum, fsdefault.parID, bspath, fs); --- 251,262 ---- return (true); ! #ifdef MACVERSION ! ! #if TARGET_API_MAC_CARBON ! /* 2005-07-17 creedon - don't use FSMakeFSSpec to fill in default directory and volume, see < http://developer.apple.com/technotes/tn/tn2015.html >, ! not sure if this is best place to do this, seems like it might be better handled at application launch */ ! GetApplicationPackageFSSpecFromBundle (&fsdefault); ! #endif ! errcode = FSMakeFSSpec (fsdefault.vRefNum, fsdefault.parID, bspath, fs); *************** *** 412,415 **** --- 414,430 ---- } /*getfsfile*/ + OSErr GetApplicationPackageFSSpecFromBundle(FSSpecPtr theFSSpecPtr) { + /* 2005-07-17 creedon - see , < http://developer.apple.com/technotes/tn/tn2015.html > */ + OSErr err = fnfErr; + CFBundleRef myAppsBundle = CFBundleGetMainBundle(); + if (myAppsBundle == NULL) return err; + CFURLRef myBundleURL = CFBundleCopyBundleURL(myAppsBundle); + if (myBundleURL == NULL) return err; + FSRef myBundleRef; + Boolean ok = CFURLGetFSRef(myBundleURL, &myBundleRef); + CFRelease(myBundleURL); + if (!ok) return err; + return FSGetCatalogInfo(&myBundleRef, kFSCatInfoNone, NULL, NULL, theFSSpecPtr, NULL); + } \ No newline at end of file |