From 51e1a785f80cccf8ed480e615ec34f31da18232c Mon Sep 17 00:00:00 2001 From: Michael Mathews Date: Sun, 8 Jul 2012 01:07:49 +0100 Subject: [PATCH] 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. --- jsdoc | 10 ++++++---- rhino_modules/jsdoc/src/scanner.js | 7 ++++--- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/jsdoc b/jsdoc index 14c31656..a6f216dd 100755 --- a/jsdoc +++ b/jsdoc @@ -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 diff --git a/rhino_modules/jsdoc/src/scanner.js b/rhino_modules/jsdoc/src/scanner.js index 2c5ad30a..8ca2f70c 100644 --- a/rhino_modules/jsdoc/src/scanner.js +++ b/rhino_modules/jsdoc/src/scanner.js @@ -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)); } });