Filter out directory paths for FileFinder in Objective-C instead of JS.

Rename FileSystemHelper-contentsOfDirectoryAtPath… to -listFilesAtPath to make it clear that we're only listing files, not subdirectories. This is a fairly special purpose method but it saves us from calling back into objective-c a ton of times to filter them in JS, and makes bringing up the file finder ~2x as fast.
This commit is contained in:
Nathan Sobo
2012-01-04 18:22:22 -07:00
parent be0fa84f1f
commit 80e4fda2f9
6 changed files with 33 additions and 33 deletions

View File

@@ -7,7 +7,6 @@ class Project
getFilePaths: ->
projectUrl = @url
fs.async.list(@url, true).pipe (urls) ->
urls = (url.replace(projectUrl, "") for url in urls when fs.isFile(url))
urls
fs.async.listFiles(@url, true).pipe (urls) ->
url.replace(projectUrl, "") for url in urls

View File

@@ -42,7 +42,7 @@ module.exports =
# Returns true if the file specified by path exists and is a
# regular file.
isFile: (path) ->
$atomController.isFile path
$atomController.fs.isFile path
# Returns an array with all the names of files contained
# in the directory path.
@@ -87,9 +87,9 @@ module.exports =
OSX.NSFileManager.defaultManager.currentDirectoryPath.toString()
async:
list: (path, recursive) ->
listFiles: (path, recursive) ->
deferred = $.Deferred()
$atomController.fs.contentsOfDirectoryAtPath_recursive_onComplete path, recursive, (subpaths) ->
$atomController.fs.listFilesAtPath_recursive_onComplete path, recursive, (subpaths) ->
deferred.resolve subpaths
deferred