This article is from the Mac Programming FAQ, by Jon Watte h+@austin.metrowerks.com with numerous contributions by others.
Under System 7, you call GetProcessInformation using the
ProcessSerialNumber kCurrentProcess with a pointer to an existing FSSpec
in the parameter block. This will give you your file, and, by using the
vRefNum and parID, the folder the application is in.
*code*
OSErr CurrentProcessLocation(FSSpec *applicationSpec)
{
ProcessSerialNumber currentPSN;
ProcessInfoRec info;
currentPSN.highLongOfPSN = 0;
currentPSN.lowLongOfPSN = kCurrentProcess;
info.processInfoLength = sizeof(ProcessInfoRec);
info.processName = NULL;
info.processAppSpec = applicationSpec;
return ( GetProcessInformation(¤tPSN, &info) );
}
*end*
 
Continue to: