Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Actually....' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Actually....
Authored by: Rosyna on Jul 05, '02 04:49:15PM
Neither of these items will show you. If you want to *really* know if an application is cocoa or not, a Cocoa application will have something like the following in it's Info.plist file:
	<key>NSMainNibFile</key>
	<string>Fire-macintosh</string>
	<key>NSPrincipalClass</key>
	<string>NSApplication</string>
A Carbon Application will not have the NSMainNibFile entry and will not say "Classic Application" in the get info window. But then neither will a Java Application.

[ Reply to This | # ]
Actually....
Authored by: hjeff on Sep 07, '03 01:57:08PM

Here's a simple shell command contribution. Gives a thumbs-up or down on whether it finds an NS string anywhere in a application folder (Program.app). I made it return a 1 or a 0 so it could be used with other programs easily, but season to taste.

#!/bin/sh
fileIn=$1
cocoaCount=`grep -rIh 'NS' "$fileIn" | wc -l`
if [ $cocoaCount -ge 1 ]
then
    echo 1
else
    echo 0
fi


[ Reply to This | # ]
Actually....
Authored by: hjeff on Sep 10, '03 04:02:15PM
I can't figure out how to edit that old entry, but here's a better version of the above (the one above gave false positives) :
#!/bin/sh
filein=$1
cocoaCount=`grep -rIh 'NS' "$filein" | grep -v Java | wc -l`
javaCount=`grep -rIh 'Java' "$filein" | wc -l`
if [ $cocoaCount -ge 1 ]
then
        echo "cocoa"
elif [ $javaCount -ge 1 ]
then
        echo "java"
else
        echo "carbon"
fi


[ Reply to This | # ]