Using string interpolation when adding extension

This commit is contained in:
Breckin Loggins
2011-07-16 14:44:26 -05:00
parent 471cf1d51a
commit 479a2e0383
2 changed files with 2 additions and 2 deletions

View File

@@ -63,7 +63,7 @@
compile = function(source, sourceIndex, topLevel) {
return path.exists(source, function(exists) {
if (topLevel && !exists && source.slice(-7) !== '.coffee') {
return compile(source + ".coffee", sourceIndex, topLevel);
return compile("" + source + ".coffee", sourceIndex, topLevel);
}
if (topLevel && !exists) {
throw new Error("File not found: " + source);

View File

@@ -79,7 +79,7 @@ compileScripts = ->
compile = (source, sourceIndex, topLevel) ->
path.exists source, (exists) ->
if topLevel and not exists and source[-7..] isnt '.coffee'
return compile source + ".coffee", sourceIndex, topLevel
return compile "#{source}.coffee", sourceIndex, topLevel
throw new Error "File not found: #{source}" if topLevel and not exists
fs.stat source, (err, stats) ->