diff --git a/jsdoc b/jsdoc index ee9c4edf..9c78cbc4 100755 --- a/jsdoc +++ b/jsdoc @@ -3,10 +3,18 @@ # rhino discards the path to the current script file, so we must add it back SOURCE="$0" while [ -h "$SOURCE" ] ; do SOURCE="$(readlink "$SOURCE")"; done -BASEPATH="$( cd -P "$( dirname "$SOURCE" )" && pwd )" +# Get a Windows path under MinGW or Cygwin +BASEPATH="$( cd -P "$( dirname "$SOURCE" )" && (pwd -W 2>/dev/null || cygpath -w $(pwd) 2>/dev/null || pwd))" +if [ "${BASEPATH:0:1}" != "/" ] ; then + BASEPATH="${BASEPATH//\\//}" + # We need a extra slash for URLs + UBASEPATH="/$BASEPATH" +else + UBASEPATH="$BASEPATH" +fi # for whatever reason, Rhino requires module paths to be valid URIs -URLPATH="file://"$BASEPATH +URLPATH="file://$UBASEPATH" URLPATH=`echo "$URLPATH" | sed -e 's/ /%20/g'` ENCODEDBASEPATH=`echo "$BASEPATH" | sed -e 's/ /%20/g'` @@ -27,6 +35,7 @@ fi if test "$1" = "-T" then echo "Running Tests" + cd -P "$(dirname "$SOURCE")" java -classpath "${BASEPATH}/lib/js.jar" ${CMD} -opt -1 -modules "${URLPATH}/nodejs_modules" -modules "${URLPATH}/rhino_modules" -modules "${URLPATH}" "${BASEPATH}/jsdoc.js" $ARGS --dirname="${BASEPATH}/" else