mirror of
https://github.com/atom/atom.git
synced 2026-04-28 03:01:47 -04:00
Set the project path when its first edit session is saved
This commit is contained in:
committed by
probablycorey
parent
9a93694a4c
commit
5291924bcc
@@ -20,6 +20,16 @@ describe "Project", ->
|
||||
anotherEditSession.destroy()
|
||||
expect(project.editSessions.length).toBe 0
|
||||
|
||||
describe "when an edit session is saved and the project has no path", ->
|
||||
it "sets the project's path to the saved file's parent directory", ->
|
||||
path = project.resolve('a')
|
||||
project.setPath(undefined)
|
||||
expect(project.getPath()).toBeUndefined()
|
||||
editSession = project.buildEditSession()
|
||||
editSession.saveAs('/tmp/atom-test-save-sets-project-path')
|
||||
expect(project.getPath()).toBe '/tmp'
|
||||
fs.remove('/tmp/atom-test-save-sets-project-path')
|
||||
|
||||
describe ".buildEditSession(path)", ->
|
||||
[absolutePath, newBufferHandler, newEditSessionHandler] = []
|
||||
beforeEach ->
|
||||
|
||||
@@ -44,6 +44,7 @@ class EditSession
|
||||
|
||||
@buffer.retain()
|
||||
@subscribe @buffer, "path-changed", =>
|
||||
@project.setPath(fs.directory(@getPath())) unless @project.getPath()?
|
||||
@trigger "title-changed"
|
||||
@trigger "path-changed"
|
||||
@subscribe @buffer, "contents-conflicted", => @trigger "contents-conflicted"
|
||||
|
||||
Reference in New Issue
Block a user