Clear StorageFolder when --clear-window-state is supplied

This commit is contained in:
Antonio Scandurra
2016-03-23 10:53:37 +01:00
parent 80146ae631
commit 25a4c4c293
2 changed files with 11 additions and 1 deletions

View File

@@ -139,7 +139,9 @@ class AtomEnvironment extends Model
@stateStore = new StateStore('AtomEnvironments', 1)
@stateStore.clear() if clearWindowState
if clearWindowState
@getStorageFolder().clear()
@stateStore.clear()
@deserializers = new DeserializerManager(this)
@deserializeTimings = {}

View File

@@ -6,6 +6,14 @@ class StorageFolder
constructor: (containingPath) ->
@path = path.join(containingPath, "storage") if containingPath?
clear: ->
return unless @path?
try
fs.removeSync(@path)
catch error
console.warn "Error deleting #{statePath}", error.stack, error
storeSync: (name, object) ->
return unless @path?