mirror of
https://github.com/atom/atom.git
synced 2026-01-22 21:38:10 -05:00
Rename traverseTree to traverseTreeSync
Also rename traverseTreeAsync to traverseTree
This commit is contained in:
@@ -77,7 +77,7 @@ describe "fs", ->
|
||||
fs.makeTree("/tmp/a/b/c")
|
||||
expect(fs.exists("/tmp/a/b/c")).toBeTruthy()
|
||||
|
||||
describe ".traverseTree(path, onFile, onDirectory)", ->
|
||||
describe ".traverseTreeSync(path, onFile, onDirectory)", ->
|
||||
fixturesDir = null
|
||||
|
||||
beforeEach ->
|
||||
@@ -88,7 +88,7 @@ describe "fs", ->
|
||||
onPath = (path) ->
|
||||
paths.push(fs.join(fixturesDir, path))
|
||||
true
|
||||
fs.traverseTree fixturesDir, onPath, onPath
|
||||
fs.traverseTreeSync fixturesDir, onPath, onPath
|
||||
expect(paths).toEqual fs.listTree(fixturesDir)
|
||||
|
||||
it "does not recurse into a directory if it is pruned", ->
|
||||
@@ -99,7 +99,7 @@ describe "fs", ->
|
||||
else
|
||||
paths.push(path)
|
||||
true
|
||||
fs.traverseTree fixturesDir, onPath, onPath
|
||||
fs.traverseTreeSync fixturesDir, onPath, onPath
|
||||
|
||||
expect(paths.length).toBeGreaterThan 0
|
||||
for path in paths
|
||||
@@ -112,8 +112,8 @@ describe "fs", ->
|
||||
paths = []
|
||||
onPath = (path) -> paths.push(path)
|
||||
|
||||
fs.traverseTree(fs.join(fixturesDir, 'symlink-to-dir'), onSymlinkPath, onSymlinkPath)
|
||||
fs.traverseTree(fs.join(fixturesDir, 'dir'), onPath, onPath)
|
||||
fs.traverseTreeSync(fs.join(fixturesDir, 'symlink-to-dir'), onSymlinkPath, onSymlinkPath)
|
||||
fs.traverseTreeSync(fs.join(fixturesDir, 'dir'), onPath, onPath)
|
||||
|
||||
expect(symlinkPaths).toEqual(paths)
|
||||
|
||||
|
||||
@@ -39,14 +39,14 @@ class Config
|
||||
templatePath = fs.join(templateConfigDirPath, path)
|
||||
configPath = fs.join(@configDirPath, path)
|
||||
fs.write(configPath, fs.read(templatePath))
|
||||
fs.traverseTree(templateConfigDirPath, onConfigDirFile, (path) -> true)
|
||||
fs.traverseTreeSync(templateConfigDirPath, onConfigDirFile, (path) -> true)
|
||||
|
||||
configThemeDirPath = fs.join(@configDirPath, 'themes')
|
||||
onThemeDirFile = (path) ->
|
||||
templatePath = fs.join(bundledThemesDirPath, path)
|
||||
configPath = fs.join(configThemeDirPath, path)
|
||||
fs.write(configPath, fs.read(templatePath))
|
||||
fs.traverseTree(bundledThemesDirPath, onThemeDirFile, (path) -> true)
|
||||
fs.traverseTreeSync(bundledThemesDirPath, onThemeDirFile, (path) -> true)
|
||||
|
||||
load: ->
|
||||
@initializeConfigDirectory()
|
||||
|
||||
@@ -70,7 +70,7 @@ class Project
|
||||
paths = []
|
||||
onFile = (path) => paths.push(path) unless @isPathIgnored(path)
|
||||
onDirectory = -> true
|
||||
fs.traverseTree(@getPath(), onFile, onDirectory)
|
||||
fs.traverseTreeSync(@getPath(), onFile, onDirectory)
|
||||
deferred.resolve(paths)
|
||||
deferred.promise()
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ class LoadPathsTask
|
||||
onDone = =>
|
||||
@callback(paths) unless @aborted
|
||||
|
||||
fs.traverseTreeAsync(rootPath, onFile, onDirectory, onDone)
|
||||
fs.traverseTree(rootPath, onFile, onDirectory, onDone)
|
||||
|
||||
abort: ->
|
||||
@aborted = true
|
||||
|
||||
@@ -92,7 +92,7 @@ module.exports =
|
||||
onPath = (path) =>
|
||||
paths.push(@join(rootPath, path))
|
||||
false
|
||||
@traverseTree(rootPath, onPath, onPath)
|
||||
@traverseTreeSync(rootPath, onPath, onPath)
|
||||
paths
|
||||
|
||||
listTree: (rootPath) ->
|
||||
@@ -100,7 +100,7 @@ module.exports =
|
||||
onPath = (path) =>
|
||||
paths.push(@join(rootPath, path))
|
||||
true
|
||||
@traverseTree(rootPath, onPath, onPath)
|
||||
@traverseTreeSync(rootPath, onPath, onPath)
|
||||
paths
|
||||
|
||||
move: (source, target) ->
|
||||
@@ -152,7 +152,7 @@ module.exports =
|
||||
@makeTree(@directory(path))
|
||||
@makeDirectory(path)
|
||||
|
||||
traverseTree: (rootPath, onFile, onDirectory) ->
|
||||
traverseTreeSync: (rootPath, onFile, onDirectory) ->
|
||||
return unless @isDirectory(rootPath)
|
||||
|
||||
traverse = (rootPath, prefix, onFile, onDirectory) =>
|
||||
@@ -168,7 +168,7 @@ module.exports =
|
||||
|
||||
traverse(rootPath, '', onFile, onDirectory)
|
||||
|
||||
traverseTreeAsync: (rootPath, onFile, onDirectory, onDone) ->
|
||||
traverseTree: (rootPath, onFile, onDirectory, onDone) ->
|
||||
pathCounter = 0
|
||||
startPath = -> pathCounter++
|
||||
endPath = -> onDone() if --pathCounter is 0
|
||||
|
||||
Reference in New Issue
Block a user