Test implementation of issue #1470. Assuming '.coffee' extension if file not found

This commit is contained in:
Breckin Loggins
2011-07-16 10:44:37 -05:00
parent 8fe59ed888
commit 3e20622bd5
2 changed files with 6 additions and 0 deletions

View File

@@ -62,6 +62,9 @@
base = path.join(source);
compile = function(source, sourceIndex, topLevel) {
return path.exists(source, function(exists) {
if (topLevel && !exists && source.lastIndexOf(".coffee") === -1) {
return compile(source + ".coffee", sourceIndex, topLevel);
}
if (topLevel && !exists) {
throw new Error("File not found: " + source);
}

View File

@@ -78,6 +78,9 @@ compileScripts = ->
base = path.join(source)
compile = (source, sourceIndex, topLevel) ->
path.exists source, (exists) ->
if topLevel and not exists and source.lastIndexOf(".coffee") == -1
return compile source + ".coffee", sourceIndex, topLevel
throw new Error "File not found: #{source}" if topLevel and not exists
fs.stat source, (err, stats) ->
throw err if err