mirror of
https://github.com/jashkenas/coffeescript.git
synced 2026-01-14 01:07:55 -05:00
Test implementation of issue #1470. Assuming '.coffee' extension if file not found
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user