mirror of
https://github.com/atom/atom.git
synced 2026-04-06 03:02:13 -04:00
Add fs.join
This commit is contained in:
@@ -11,6 +11,12 @@ describe "fs", ->
|
||||
expect(fs.directory(require.resolve('fixtures/dir'))).toBe require.resolve('fixtures/dir/')
|
||||
expect(fs.directory(require.resolve('fixtures/dir/'))).toBe require.resolve('fixtures/dir/')
|
||||
|
||||
describe ".join(paths...)", ->
|
||||
it "concatenates the given paths with the directory seperator", ->
|
||||
expect(fs.join('a')).toBe 'a'
|
||||
expect(fs.join('a', 'b', 'c')).toBe 'a/b/c'
|
||||
expect(fs.join('/a/b/', 'c', 'd')).toBe '/a/b/c/d'
|
||||
expect(fs.join('a', 'b/c/', 'd/')).toBe 'a/b/c/d/'
|
||||
|
||||
describe ".async", ->
|
||||
describe ".listFiles(directoryPath, recursive)", ->
|
||||
|
||||
@@ -35,6 +35,11 @@ module.exports =
|
||||
exists: (path) ->
|
||||
OSX.NSFileManager.defaultManager.fileExistsAtPath_isDirectory path, null
|
||||
|
||||
join: (paths...) ->
|
||||
return paths[0] if paths.length == 1
|
||||
[first, rest...] = paths
|
||||
first.replace(/\/?$/, "/") + @join(rest...)
|
||||
|
||||
# Returns true if the file specified by path exists and is a
|
||||
# directory.
|
||||
isDirectory: (path) ->
|
||||
|
||||
Reference in New Issue
Block a user