File.expand, Dir.list

This commit is contained in:
Chris Wanstrath 2011-08-23 00:30:56 -07:00
parent 22c4b0c026
commit ba1531b94a

View File

@ -106,10 +106,21 @@ Chrome =
# Handles the file system
File =
read: (path) ->
OSX.NSString.stringWithContentsOfFile path
OSX.NSString.stringWithContentsOfFile File.expand path
write: (path, contents) ->
str = OSX.NSString.stringWithString contents
str.writeToFile_atomically path, true
str.writeToFile_atomically File.expand(path), true
expand: (path) ->
if /~/.test path
OSX.NSString.stringWithString(path).stringByExpandingTildeInPath
else
path
Dir =
list: (path) ->
path = File.expand path
_.map OSX.NSFileManager.defaultManager.subpathsAtPath(path), (entry) ->
"#{path}/#{entry}"
this.Chrome = Chrome
this.File = File
this.File = File
this.Dir = Dir