atomController.path => window.path

This commit is contained in:
Chris Wanstrath
2011-11-06 15:59:26 -08:00
parent d94f251309
commit cba6fb844a
5 changed files with 17 additions and 17 deletions

View File

@@ -13,7 +13,6 @@ class FilefinderPane extends Pane
html: require "filefinder/filefinder.html"
constructor: (@filefinder) ->
@path = atomController.path
$('#filefinder input').live 'keydown', @onKeydown
css = File.read require.resolve 'filefinder/facebox.css'
@@ -43,9 +42,9 @@ class FilefinderPane extends Pane
@showFinder()
@showing = not @showing
paths: ->
paths: ->
_paths = []
for dir in File.list @path
for dir in File.list window.path
continue if /\.git|Cocoa/.test dir
_paths.push File.listDirectoryTree dir
_.reject _.flatten(_paths), (dir) -> File.isDirectory dir
@@ -54,7 +53,7 @@ class FilefinderPane extends Pane
$.facebox @html
@files = []
for file in @paths()
@files.push file.replace "#{@path}/", ''
@files.push file.replace "#{window.path}/", ''
@filterFiles()
findMatchingFiles: (query) ->
@@ -87,7 +86,7 @@ class FilefinderPane extends Pane
$('#filefinder li:first').addClass 'selected'
openSelected: ->
dir = @path
dir = window.path
file = $('#filefinder .selected').text()
window.open "#{dir}/#{file}"
@toggle()

View File

@@ -47,8 +47,8 @@ class TreePane extends Pane
true
reload: ->
@html.children('#tree .cwd').text _.last atomController.path.split '/'
fileList = @createList atomController.path
@html.children('#tree .cwd').text _.last window.path.split '/'
fileList = @createList window.path
fileList.addClass 'files'
@html.children('#tree .files').replaceWith fileList

View File

@@ -16,7 +16,7 @@ class Tree extends Extension
KeyBinder.load require.resolve "tree/key-bindings.coffee"
# watch the root dir
Watcher.watch atomController.path, @watchDir
Watcher.watch window.path, @watchDir
# Hide dirs that no longer exist, watch dirs that do.
for dir in @shownDirs()
@@ -34,7 +34,7 @@ class Tree extends Extension
@unwatchDir dir for dir in @shownDirs()
shownDirStorageKey: ->
@.constructor.name + ":" + atomController.path + ":shownDirs"
@.constructor.name + ":" + window.path + ":shownDirs"
watchDir: (dir) =>
@pane.reload()

View File

@@ -16,8 +16,8 @@ class Editor
buffers: {}
openPathsKey: "editor.openPaths.#{atomController.path}"
focusedPathKey: "editor.focusedPath.#{atomController.path}"
openPathsKey: "editor.openPaths.#{window.path}"
focusedPathKey: "editor.focusedPath.#{window.path}"
constructor: (path) ->
KeyBinder.register "editor", @

View File

@@ -19,10 +19,11 @@ windowAdditions =
startup: () ->
KeyBinder.register "window", window
@setTitle atomController.path
@path = atomController.path
@setTitle @path
@editor = if fs.isFile atomController.path
new Editor atomController.path
@editor = if fs.isFile @path
new Editor @path
else
new Editor
@@ -33,7 +34,7 @@ windowAdditions =
@editor.restoreOpenBuffers()
storageKey: ->
"window:" + atomController.path
"window:" + @path
loadExtensions: ->
extension.shutdown() for extension in @extensions
@@ -73,7 +74,7 @@ windowAdditions =
reload: ->
atomController.close
OSX.NSApp.createController atomController.path
OSX.NSApp.createController @path
# Do open and close even belong here?
open: (path) ->
@@ -96,7 +97,7 @@ windowAdditions =
Event.trigger.apply Event, arguments
canOpen: (path) ->
parent = atomController.path.replace(/([^\/])$/, "$1/")
parent = @path.replace(/([^\/])$/, "$1/")
child = path.replace(/([^\/])$/, "$1/")
# If the child is contained by the parent, it can be opened by this window