How to check appledoc valid or not in the xcode build phases run script?

479 views Asked by At
i'm working in generating docset for a ios project, but stumped. 

as you known, we can write a sh script for the xcode build phases run script; and i want it run only when the project in release version & the software appledoc already installed, so i write it as follows:

# appledoc Xcode script
APPLEDOC_PATH=`which appledoc`
if [ $APPLEDOC_PATH ]; then
if [ "${CONFIGURATION}" = "Release" ]; then
#============================#
#   some code here, omit!    #
#============================#
fi
fi

it seems not work at all! and i know the problem is the command 'which appledoc' went wrong! so the question is:

how to check appledoc valid or not in the xcode build phases run script?
any ideas? please give a hand! thanks!
1

There are 1 answers

1
ManuQiao On

I've met the problem just days ago. If the execute file is not under /bin/sh . The command may not be found.

!!Use full path!!

I installed appledoc with macports, the bin path is /opt/local/bin .

So, it becomes 'ls' command rather than 'which' command.

It looks no option to make port command return its bin path. If other package manager can do, don't make hard code like that.

I checked $PATH and printed it with Xcode script. The path /opt/local/bin is exist.So I still have no idea why it can't find appledoc in the script.