mirror of
https://github.com/atom/atom.git
synced 2026-01-23 05:48:10 -05:00
Only load/save AtomEnvironment state if persistence is enabled
This commit is contained in:
@@ -141,10 +141,13 @@ describe "AtomEnvironment", ->
|
||||
expect(errors).toEqual []
|
||||
|
||||
describe "saving and loading", ->
|
||||
it "selects the state based on the current project paths", ->
|
||||
jasmine.unspy(atom, 'saveStateSync')
|
||||
# jasmine.unspy(atom, 'loadStateSync')
|
||||
beforeEach ->
|
||||
atom.enablePersistence = true
|
||||
|
||||
afterEach ->
|
||||
atom.enablePersistence = false
|
||||
|
||||
it "selects the state based on the current project paths", ->
|
||||
[dir1, dir2] = [temp.mkdirSync("dir1-"), temp.mkdirSync("dir2-")]
|
||||
|
||||
loadSettings = _.extend atom.getLoadSettings(),
|
||||
|
||||
@@ -74,8 +74,6 @@ beforeEach ->
|
||||
spyOn(window, "setTimeout").andCallFake window.fakeSetTimeout
|
||||
spyOn(window, "clearTimeout").andCallFake window.fakeClearTimeout
|
||||
|
||||
spyOn(atom, 'saveStateSync')
|
||||
|
||||
spy = spyOn(atom.packages, 'resolvePackagePath').andCallFake (packageName) ->
|
||||
if specPackageName and packageName is specPackageName
|
||||
resolvePackagePath(specPackagePath)
|
||||
|
||||
@@ -758,12 +758,16 @@ class AtomEnvironment extends Model
|
||||
@applicationDelegate.showSaveDialog(options)
|
||||
|
||||
saveStateSync: ->
|
||||
return unless @enablePersistence
|
||||
|
||||
if storageKey = @getStateKey(@project?.getPaths())
|
||||
@getStorageFolder().store(storageKey, @state)
|
||||
else
|
||||
@getCurrentWindow().loadSettings.windowState = JSON.stringify(@state)
|
||||
|
||||
loadStateSync: ->
|
||||
return unless @enablePersistence
|
||||
|
||||
startTime = Date.now()
|
||||
|
||||
if stateKey = @getStateKey(@getLoadSettings().initialPaths)
|
||||
|
||||
Reference in New Issue
Block a user