mirror of
https://github.com/atom/atom.git
synced 2026-02-08 21:55:05 -05:00
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:
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user