Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

Fixed an issue with user supplied directories being cropped off when …

…importing coffeescript.
  • Loading branch information...
1 parent 9e2eac0 commit fa033272976dfead5a9dda4ba85dd60a5f86d072 @leeola committed
Showing with 9 additions and 2 deletions.
  1. +9 −2 lib/
11 lib/
@@ -66,7 +66,6 @@ exec = (input) ->
for user_file in opts.files
# Resolve the path relative to the cwd.
file = path.join process.cwd(), user_file
- dirname = path.dirname file
# Check if the file specified by the user even exists.
if not existsSync(file)
@@ -78,11 +77,19 @@ exec = (input) ->
throw new Error "The file '#{user_file}' does not exist."
+ # If the user supplied path is a directory, we need to make sure not to
+ # use dirname(), as it pops off the ending path, leaving you up one
+ # more directory than you intended.
+ stat = fs.statSync file
+ if stat.isDirectory()
+ dirname = file
+ else
+ dirname = path.dirname file
# If the user didn't specify a coffee option, attempt to figure
# out if the file is CoffeeScript. The below code also supports
# specifying a directory with a coffee index file.
if is undefined
- stat = fs.statSync file
if stat.isFile() and path.extname(file) is '.coffee'
else if stat.isDirectory()

0 comments on commit fa03327

Please sign in to comment.
Something went wrong with that request. Please try again.