mirror of
https://github.com/atom/atom.git
synced 2026-01-23 13:58:08 -05:00
Add fs.makeTree
This commit is contained in:
@@ -54,6 +54,14 @@ describe "fs", ->
|
||||
it "returns an empty string for paths without an extension", ->
|
||||
expect(fs.extension("a/b.not-extension/a-dir")).toBe ''
|
||||
|
||||
describe "makeTree(path)", ->
|
||||
beforeEach ->
|
||||
fs.remove("/tmp/a") if fs.exists("/tmp/a")
|
||||
|
||||
it "creates all directories in path including any missing parent directories", ->
|
||||
fs.makeTree("/tmp/a/b/c")
|
||||
expect(fs.exists("/tmp/a/b/c")).toBeTruthy()
|
||||
|
||||
describe ".traverseTree(path, fn)", ->
|
||||
fixturesDir = null
|
||||
|
||||
|
||||
@@ -93,6 +93,14 @@ module.exports =
|
||||
makeDirectory: (path) ->
|
||||
$native.makeDirectory(path)
|
||||
|
||||
# Creates the directory specified by "path" including any missing parent
|
||||
# directories.
|
||||
makeTree: (path) ->
|
||||
return unless path
|
||||
if not @exists(path)
|
||||
@makeTree(@directory(path))
|
||||
@makeDirectory(path)
|
||||
|
||||
traverseTree: (rootPath, fn) ->
|
||||
recurse = null
|
||||
prune = -> recurse = false
|
||||
|
||||
Reference in New Issue
Block a user