I used to do that (I know, it is deprecated) :
function f_GetAppDir (var L_dir: SInt32; var x_vrn: SInt16): t_OSErr;
var
L_psn: ProcessSerialNumber;
xx_cat: FSCatalogInfo;
xx_ref: FSRef;
L_oss: OSStatus;
xErr: OSErr;
L_err: t_OSErr;
begin
L_err := 1;
{ - }
L_oss := GetProcessBundleLocation(L_psn, xx_ref);
if L_oss = noErr then
begin
xErr := FSGetCatalogInfo(xx_ref, kFSCatInfoVolume + kFSCatInfoParentDirID,
@xx_cat,
nil, nil, nil);
if xErr = noErr then
begin
L_dir := xx_cat.parentDirID;
x_vrn := xx_cat.volume;
{ - }
L_err := k_noErr
end
else
L_err := xErr
end
else
{ - }
f_GetAppDir = L_err
end;
DEPRECATED, but it works on Mac OS 64 bits