Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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

…importing coffeescript.
  • Loading branch information...
commit fa033272976dfead5a9dda4ba85dd60a5f86d072 1 parent 9e2eac0
Lee Olayvar authored
Showing with 9 additions and 2 deletions.
  1. +9 −2 lib/bin.coffee
11 lib/bin.coffee
View
@@ -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) ->
else
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 opts.coffee is undefined
- stat = fs.statSync file
if stat.isFile() and path.extname(file) is '.coffee'
import_coffee()
else if stat.isDirectory()
Please sign in to comment.
Something went wrong with that request. Please try again.