> I wonder if the NSBundle method executableArchitecture will do it? Will do some tests and report back.
I think that works. As it happens, it is for a Cocoa app (LegacyAPISurvey) but here's the CF equivalent. If anyone can see any flaws, please shout up:
'---------------
include "ConsoleWindow"
include "Util_FileDirectory.incl"
dim as CFURLRef url
dim as CFBundleRef bundle
dim as CFArrayRef array
dim as CFIndex count, index
dim as SInt32 value
long if ( fn FD_PathCreateCFURL( @"Applications/iTunes.app", 0, @url ) == _noErr )
bundle = fn CFBundleCreate( _kCFAllocatorDefault, url )
long if ( bundle )
array = fn CFBundleCopyExecutableArchitectures( bundle )
long if ( array )
count = fn CFArrayGetCount( array )
long if ( count )
for index = 0 to count - 1
long if ( fn CFNumberGetValue( fn CFArrayGetValueAtIndex( array, index ), _kCFNumberSInt32Type, @value ) )
select ( value )
case _kCFBundleExecutableArchitectureI386 : print "i386"
case _kCFBundleExecutableArchitecturePPC : print "ppc"
case _kCFBundleExecutableArchitectureX8664 : print "x86_64"
case _kCFBundleExecutableArchitecturePPC64 : print "ppc64"
end select
end if
next index
end if
CFRelease( array )
xelse
print "Not found!"
end if
CFRelease( bundle )
end if
CFRelease( url )
end if
'---------------
Bernie