From 22649889fbbf5b0a27d9fba2906145e8a28ae11f Mon Sep 17 00:00:00 2001 From: Chris Wanstrath Date: Sat, 27 Aug 2011 14:27:06 -0700 Subject: [PATCH] Dir.list only goes one level deep unless you ask it to go deeper --- src/osx.coffee | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/osx.coffee b/src/osx.coffee index 0b68c196d..54a8241f7 100644 --- a/src/osx.coffee +++ b/src/osx.coffee @@ -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)