mirror of
https://github.com/atom/atom.git
synced 2026-02-08 13:45:09 -05:00
kill Process, split into fs module and system module
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
$ = require 'jquery'
|
||||
_ = require 'underscore'
|
||||
|
||||
{Chrome, Process} = require 'osx'
|
||||
{Chrome} = require 'osx'
|
||||
File = require 'fs'
|
||||
|
||||
ace = require 'ace/ace'
|
||||
@@ -25,7 +25,7 @@ exports.open = open = (path) ->
|
||||
filename = path
|
||||
|
||||
if File.isDir filename
|
||||
Process.cwd filename
|
||||
File.changeWorkingDirectory filename
|
||||
Chrome.title _.last filename.split '/'
|
||||
editor.getSession().setValue ""
|
||||
Chrome.setDirty false
|
||||
|
||||
@@ -12,6 +12,10 @@ module.exports =
|
||||
else
|
||||
path
|
||||
|
||||
# Set the current working directory to `path`.
|
||||
changeWorkingDirectory: (path) ->
|
||||
OSX.NSFileManager.defaultManager.changeCurrentDirectoryPath path
|
||||
|
||||
# Returns true if the file specified by path exists and is a
|
||||
# directory.
|
||||
isDirectory: (path) ->
|
||||
@@ -54,3 +58,7 @@ module.exports =
|
||||
write: (path, content) ->
|
||||
str = OSX.NSString.stringWithString content
|
||||
str.writeToFile_atomically @absolute(path), true
|
||||
|
||||
# Return the path name of the current working directory.
|
||||
workingDirectory: ->
|
||||
OSX.NSFileManager.defaultManager.currentDirectoryPath.toString()
|
||||
@@ -87,16 +87,6 @@ Chrome =
|
||||
appRoot: ->
|
||||
OSX.NSBundle.mainBundle.resourcePath
|
||||
|
||||
Process =
|
||||
cwd: (path) ->
|
||||
if path?
|
||||
OSX.NSFileManager.defaultManager.changeCurrentDirectoryPath path
|
||||
else
|
||||
OSX.NSFileManager.defaultManager.currentDirectoryPath.toString()
|
||||
|
||||
env: ->
|
||||
OSX.NSProcess.processInfo.environment
|
||||
|
||||
exports.Chrome = Chrome
|
||||
exports.File = File
|
||||
exports.Dir = Dir
|
||||
|
||||
7
src/system.coffee
Normal file
7
src/system.coffee
Normal file
@@ -0,0 +1,7 @@
|
||||
# commonjs system module
|
||||
# http://ringojs.org/api/v0.8/system/
|
||||
|
||||
module.exports = ->
|
||||
# An object containing our environment variables.
|
||||
env: ->
|
||||
OSX.NSProcess.processInfo.environment
|
||||
Reference in New Issue
Block a user