Add directory method to fs

This commit is contained in:
Corey Johnson & Nathan Sobo
2011-12-29 11:43:32 -08:00
parent 35e4b0e969
commit ef628f0ad4

View File

@@ -28,6 +28,11 @@ module.exports =
changeWorkingDirectory: (path) ->
OSX.NSFileManager.defaultManager.changeCurrentDirectoryPath path
# Return the dirname of the given path. That is the path with any trailing
# non-directory component removed.
directory: (path) ->
@absolute(path).replace(new RegExp(@base(path) + '$'), '')
# Returns true if the file specified by path exists
exists: (path) ->
OSX.NSFileManager.defaultManager.fileExistsAtPath_isDirectory path, null