Last active
September 27, 2016 12:02
-
-
Save phaus/493d5c54e0dd39b785a5eb1f1dcf9237 to your computer and use it in GitHub Desktop.
check for OBJC_IMAGE_SUPPORTS_GC macOS Sierra compatibility
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
checkFile(){ | |
FILE=$1 | |
OTOOL=`which otool` | |
TAIL=`which tail` | |
IFS='/' read -ra ADDR <<< "$FILE" | |
unset APP | |
for i in "${ADDR[@]}"; do | |
if [[ ! "${i-}" = $'\n' ]]; then | |
if [[ ! $APP ]] && [[ "$i" == *.app ]]; then | |
APP="${i}"; | |
fi | |
fi | |
done | |
if [ "$APP" != "$LASTAPP" ]; then | |
LASTAPP=$APP | |
PROG=${APP%".app"} | |
PATH=${FILE%"/Contents/Info.plist"} | |
if [[ -f ${PATH}/Contents/MacOS/${PROG} ]]; then | |
CMD=`${OTOOL} -oV "${PATH}/Contents/MacOS/${PROG}" | ${TAIL} -3` | |
if [[ $CMD == *"OBJC_IMAGE_SUPPORTS_GC"* ]]; then | |
echo "${PATH}: false"; | |
echo "$CMD"; | |
#else | |
# echo "${PATH}: true"; | |
fi | |
fi | |
fi | |
} | |
export -f checkFile | |
LASTAPP="null" | |
find / -path "*.app/Contents/Info.plist" -exec bash -c 'checkFile "$0"' {} \; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Awesome! Thank you!