Dir.list only goes one level deep unless you ask it to go deeper

This commit is contained in:
Chris Wanstrath 2011-08-27 14:27:06 -07:00
parent 488697884f
commit 22649889fb

View File

@ -129,10 +129,14 @@ File =
exists and not isDir.valueOf()
Dir =
list: (path) ->
list: (path, recursive) ->
path = File.expand path
_.map OSX.NSFileManager.defaultManager.subpathsAtPath(path), (entry) ->
"#{path}/#{entry}"
fm = OSX.NSFileManager.defaultManager
if recursive
paths = fm.subpathsAtPath path
else
paths = fm.contentsOfDirectoryAtPath_error path, null
_.map paths, (entry) -> "#{path}/#{entry}"
isDir: (path) ->
isDir = new outArgument
exists = OSX.NSFileManager.defaultManager.fileExistsAtPath_isDirectory(path, isDir)