Use the right project path for document title

This commit is contained in:
Max Brunsfeld
2015-02-24 16:06:57 -08:00
parent 33af0f028b
commit 224803c25f

View File

@@ -159,16 +159,24 @@ class Workspace extends Model
# open.
updateWindowTitle: =>
appName = 'Atom'
if projectPath = atom.project?.getPaths()[0]
if item = @getActivePaneItem()
document.title = "#{item.getTitle?() ? 'untitled'} - #{projectPath} - #{appName}"
atom.setRepresentedFilename(item.getPath?() ? projectPath)
else
document.title = "#{projectPath} - #{appName}"
atom.setRepresentedFilename(projectPath)
projectPaths = atom.project?.getPaths() ? []
if item = @getActivePaneItem()
itemPath = item.getPath?()
itemTitle = item.getTitle?()
projectPath = _.find projectPaths, (projectPath) ->
itemPath is projectPath or itemPath?.startsWith(projectPath + path.sep)
itemTitle ?= "untitled"
projectPath ?= projectPaths[0]
if item? and projectPath?
document.title = "#{itemTitle} - #{projectPath} - #{appName}"
atom.setRepresentedFilename(itemPath ? projectPath)
else if projectPath?
document.title = "#{projectPath} - #{appName}"
atom.setRepresentedFilename(projectPath)
else
document.title = "untitled - #{appName}"
atom.setRepresentedFilename('')
document.title = "#{itemTitle} - #{appName}"
atom.setRepresentedFilename("")
# On OS X, fades the application window's proxy icon when the current file
# has been modified.