improve function name

This commit is contained in:
Jeff Williams 2012-09-24 08:55:23 -07:00
parent b9ed72118c
commit 9ae503e6ed

View File

@ -229,24 +229,24 @@ function main() {
var result;
template = template || 'templates/default';
function noSuchPath(_path) {
function pathExists(_path) {
try {
fs.readdirSync(_path);
}
catch(e) {
return true;
return false;
}
return false;
return true;
}
// first, try resolving it relative to the current working directory (or just normalize it
// if it's an absolute path)
result = path.resolve(template);
if ( noSuchPath(result) ) {
if ( !pathExists(result) ) {
// next, try resolving it relative to the JSDoc directory
result = path.resolve(env.dirname, template);
if ( noSuchPath(result) ) {
if ( !pathExists(result) ) {
// restore the original value so the user gets a reasonable error message
result = template;
}