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


Click here to return to the '10.6 compatibility' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
10.6 compatibility
Authored by: TokyoJimu on Mar 31, '10 05:51:28PM

[revised version after further testing]

The output of the --mime option to file(1) has changed in 10.6 (Snow Leopard), necessitating changing these lines in view_attachment:

# if the type is empty then try to figure it out.
if [ -z "$type" ]; then
type=`file -b --mime "$1" | cut -d"/" -f2`
fi

to:

# Get the OS version number and strip out the decimal points so we can
# use integer comparison, and so it will work for future versions.
osxversion=`sw_vers -productVersion | sed s/\\\.//g`
echo osxversion is ${osxversion}

# if the type is empty then try to figure it out.
if [ -z "$type" ]; then
if [ ${osxversion} -lt 1060 ]; then #OS X 10.5 or lower
type=`file -b --mime "$1" | cut -d"/" -f2`
else # For 10.6, you need the following instead
type=`file -b --mime-type "$1" | cut -d"/" -f2`
fi
fi



[ Reply to This | # ]