--- main.c.orig 2010-01-10 02:18:05.000000000 -0800 +++ main.c 2010-01-10 02:18:06.000000000 -0800 @@ -70,7 +70,6 @@ OSErr LoadMenuBar(char *appName); -static OSStatus FSMakePath(FSSpec file, char *path, long maxPathSize); static void RedFatalAlert(Str255 errorString, Str255 expStr); static short DoesFileExist(char *path); @@ -233,7 +232,6 @@ CFBundleRef appBundle; CFURLRef scriptFileURL; FSRef fileRef; - FSSpec fileSpec; char *path; //get CF URL for script @@ -250,14 +248,10 @@ //dispose of the CF variables CFRelease(scriptFileURL); CFRelease(fileName); - - //convert FSRef to FSSpec - if (FSGetCatalogInfo(&fileRef, kFSCatInfoNone, NULL, NULL, &fileSpec, - NULL)) return NULL; - + //create path string if (! (path = malloc(kMaxPathLength))) return NULL; - if (FSMakePath(fileSpec, path, kMaxPathLength)) return NULL; + if (FSRefMakePath(&fileRef, path, kMaxPathLength)) return NULL; if (! DoesFileExist(path)) return NULL; return path; @@ -272,7 +266,6 @@ CFBundleRef appBundle; CFURLRef openDocFileURL; FSRef fileRef; - FSSpec fileSpec; char *path; //get CF URL for openDoc @@ -290,13 +283,9 @@ CFRelease(openDocFileURL); CFRelease(fileName); - //convert FSRef to FSSpec - if (FSGetCatalogInfo(&fileRef, kFSCatInfoNone, NULL, NULL, &fileSpec, - NULL)) return NULL; - //create path string if (! (path = malloc(kMaxPathLength))) return NULL; - if (FSMakePath(fileSpec, path, kMaxPathLength)) return NULL; + if (FSRefMakePath(&fileRef, path, kMaxPathLength)) return NULL; if (! DoesFileExist(path)) return NULL; return path; @@ -321,27 +310,12 @@ #pragma mark - -/////////////////////////////////////// -// Generate path string from FSSpec record -/////////////////////////////////////// -static OSStatus FSMakePath(FSSpec file, char *path, long maxPathSize) -{ - OSErr err = noErr; - FSRef fileRef; - - //create file reference from file spec - if (err = FSpMakeFSRef(&file, &fileRef)) return err; - - // and then convert the FSRef to a path - return FSRefMakePath(&fileRef, path, maxPathSize); -} - //////////////////////////////////////// // Standard red error alert, then exit application //////////////////////////////////////// static void RedFatalAlert (Str255 errorString, Str255 expStr) { - StandardAlert(kAlertStopAlert, errorString, expStr, NULL, NULL); +// StandardAlert(kAlertStopAlert, errorString, expStr, NULL, NULL); ExitToShell(); } @@ -396,7 +370,7 @@ short i; long count, actualSize; - FSSpec fileSpec; + FSRef fileRef; char path[kMaxPathLength]; while (numArgs > 0) free(fileArgs[numArgs--]); @@ -408,12 +382,12 @@ err = AECountItems(&fileSpecList, &count); //Count number of files for (i = 1; i <= count; i++) { //iteratively process each file - //get fsspec from apple event - if (! (err = AEGetNthPtr(&fileSpecList, i, typeFSS, &keyword, &type, - (Ptr)&fileSpec, sizeof(FSSpec), &actualSize))) + //get fsref from apple event + if (! (err = AEGetNthPtr(&fileSpecList, i, typeFSRef, &keyword, &type, + (Ptr)&fileRef, sizeof(FSRef), &actualSize))) { //get path from file spec - if ((err = FSMakePath(fileSpec, (unsigned char *)&path, + if ((err = FSRefMakePath(&fileRef, (unsigned char *)&path, kMaxPathLength))) return err; if (numArgs == kMaxArgumentsToScript) break;