state: set statePath when opening a state file from the server (#590)

This commit is contained in:
bordun 2020-01-30 13:31:12 +01:00
parent 3ba0719013
commit 2d1ddd3353
4 changed files with 13 additions and 3 deletions

View file

@ -55,7 +55,7 @@ module.exports = {
stateLoad: function(data){
state.load(data.state, data.send)
state.load(data.state, data.send, data.path)
},

View file

@ -119,10 +119,12 @@ var StateManager = class StateManager {
}
load(state, send) {
load(state, send, path) {
if (!state) return
this.setStatePath(path)
try {
if (typeof state === 'string') {
state = JSON.parse(state)
@ -188,6 +190,13 @@ var StateManager = class StateManager {
}
setStatePath(path) {
if (!path) return
this.statePath = path
}
pushValueState(id, value) {
this.valueStateQueue[id] = value
}

View file

@ -212,7 +212,7 @@ module.exports = {
module.exports.fileRead(data, clientId, true, (result)=>{
ipc.send('stateLoad', {state: result, send: true}, clientId)
ipc.send('stateLoad', {state: result, path: data.path, send: true}, clientId)
})