mirror of
https://github.com/atom/atom.git
synced 2026-04-28 03:01:47 -04:00
Parameterize configDirPath and move config.load in ctor
This commit is contained in:
@@ -4,12 +4,16 @@ fs = require "fs-plus"
|
||||
module.exports =
|
||||
class StorageFolder
|
||||
constructor: (containingPath) ->
|
||||
@path = path.join(containingPath, "storage")
|
||||
@path = path.join(containingPath, "storage") if containingPath?
|
||||
|
||||
store: (name, object) ->
|
||||
return unless @path?
|
||||
|
||||
fs.writeFileSync(@pathForKey(name), JSON.stringify(object), 'utf8')
|
||||
|
||||
load: (name) ->
|
||||
return unless @path?
|
||||
|
||||
statePath = @pathForKey(name)
|
||||
try
|
||||
stateString = fs.readFileSync(statePath, 'utf8')
|
||||
|
||||
Reference in New Issue
Block a user