mirror of
https://github.com/atom/atom.git
synced 2026-01-22 21:38:10 -05:00
More helper methods (that will be refactored into a commonJS style object)
This commit is contained in:
@@ -29,6 +29,7 @@ Chrome =
|
||||
# Returns null or a file path.
|
||||
openPanel: ->
|
||||
panel = OSX.NSOpenPanel.openPanel
|
||||
panel.setCanChooseDirectories(true)
|
||||
if panel.runModal isnt OSX.NSFileHandlingPanelOKButton
|
||||
return null
|
||||
panel.filenames.lastObject
|
||||
@@ -120,15 +121,27 @@ File =
|
||||
OSX.NSString.stringWithString(path).stringByExpandingTildeInPath
|
||||
else
|
||||
path
|
||||
isFile: (path) ->
|
||||
isDir = new outArgument
|
||||
exists = OSX.NSFileManager.defaultManager.fileExistsAtPath_isDirectory(path, isDir)
|
||||
exists and not isDir.valueOf()
|
||||
|
||||
Dir =
|
||||
list: (path) ->
|
||||
path = File.expand path
|
||||
_.map OSX.NSFileManager.defaultManager.subpathsAtPath(path), (entry) ->
|
||||
"#{path}/#{entry}"
|
||||
isDir: (path) ->
|
||||
isDir = new outArgument
|
||||
exists = OSX.NSFileManager.defaultManager.fileExistsAtPath_isDirectory(path, isDir)
|
||||
exists and isDir.valueOf()
|
||||
|
||||
Process =
|
||||
cwd: ->
|
||||
OSX.NSFileManager.defaultManager.currentDirectoryPath()
|
||||
cwd: (path) ->
|
||||
if dir?
|
||||
OSX.NSFileManager.defaultManager.changeCurrentDirectoryPath(path)
|
||||
else
|
||||
OSX.NSFileManager.defaultManager.currentDirectoryPath()
|
||||
|
||||
env: ->
|
||||
OSX.NSProcess.processInfo.environment()
|
||||
|
||||
Reference in New Issue
Block a user