Every window has a path

This commit is contained in:
Corey Johnson
2011-10-28 17:12:16 -07:00
parent 8b906e40c1
commit 445e5a8ce0
9 changed files with 91 additions and 59 deletions

View File

@@ -14,12 +14,18 @@ windowAdditions =
appRoot: OSX.NSBundle.mainBundle.resourcePath
path: localStorage.lastOpenedPath ? fs.workingDirectory()
path: null
startup: () ->
@path = atomController.path ? @recentPath()
console.log localStorage.hi
localStorage.hi = "12345"
console.log localStorage
@showConsole()
startup: ->
KeyBinder.register "window", window
@editor = new Editor()
@editor = new Editor @path
@loadExtensions()
@@ -47,15 +53,32 @@ windowAdditions =
console.warn "window: Extension #{extension.constructor.name} failed to startup."
console.warn error
recentPath: ->
localStorage.lastOpenedPath ? "/tmp/atom"
setRecentPath: (path) ->
console.log "New Path #{path}"
localStorage.lastOpenedPath = path
handleKeyEvent: ->
KeyBinder.handleEvent.apply KeyBinder, arguments
showConsole: ->
atomController.webView.inspector.showConsole true
reload: ->
@close()
Native.newWindow @path
open: (path) ->
path = Native.openPanel() if not path
Event.trigger 'window:open', path if path
if path
@path = path
@setRecentPath path
Event.trigger 'window:open', path
close: ->
atomController.close()
for key, value of windowAdditions
console.warn "DOMWindow already has a key named `#{key}`" if window[key]