Rhino likes the filepaths (all args really) to be url encoded, which is an issue if spaces appear in filepaths. This makes JSDoc cooperate better with that rule.

This commit is contained in:
Michael Mathews 2012-07-08 01:07:49 +01:00
parent 4ac7f4b488
commit 51e1a785f8
2 changed files with 10 additions and 7 deletions

10
jsdoc
View File

@ -10,7 +10,9 @@ URLPATH="file://"$BASEPATH
URLPATH=`echo "$URLPATH" | sed -e 's/ /%20/g'`
ENCODEDBASEPATH=`echo "$BASEPATH" | sed -e 's/ /%20/g'`
if test $1 = "--debug"
ARGS="$@"
if test "$1" = "--debug"
then
echo "Running Debug"
CMD="org.mozilla.javascript.tools.debugger.Main -debug"
@ -20,12 +22,12 @@ else
fi
#Conditionally execute different command lines depending on whether we're running tests or not
if test $1 = "-T"
if test "$1" = "-T"
then
echo "Running Tests"
java -classpath "${BASEPATH}/lib/js.jar" ${CMD} -opt -1 -modules "${URLPATH}/node_modules" -modules "${URLPATH}/rhino_modules" -modules "${URLPATH}" "${BASEPATH}/jsdoc.js" $@ --dirname="${BASEPATH}/"
java -classpath "${BASEPATH}/lib/js.jar" ${CMD} -opt -1 -modules "${URLPATH}/node_modules" -modules "${URLPATH}/rhino_modules" -modules "${URLPATH}" "${BASEPATH}/jsdoc.js" $ARGS --dirname="${BASEPATH}/"
else
# normal mode should be quiet
java -classpath "${BASEPATH}/lib/js.jar" ${CMD} -modules "${URLPATH}/node_modules" -modules "${URLPATH}/rhino_modules" -modules "${URLPATH}" "${BASEPATH}/jsdoc.js" $@ --dirname="${BASEPATH}/"
java -classpath "${BASEPATH}/lib/js.jar" ${CMD} -modules "${URLPATH}/node_modules" -modules "${URLPATH}/rhino_modules" -modules "${URLPATH}" "${BASEPATH}/jsdoc.js" $ARGS --dirname="${BASEPATH}/"
fi

View File

@ -36,11 +36,12 @@ exports.Scanner.prototype.scan = function(searchPaths, depth, filter) {
depth = depth || 1;
searchPaths.forEach(function($) {
if ( fs.stat($).isFile() ) {
filePaths.push($);
var filepath = decodeURIComponent($);
if ( fs.stat(filepath).isFile() ) {
filePaths.push(filepath);
}
else {
filePaths = filePaths.concat(fs.ls($, depth));
filePaths = filePaths.concat(fs.ls(filepath, depth));
}
});