diff --git a/CHANGELOG.md b/CHANGELOG.md index 6b50cd26..e533ae3e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ - editor: errors when hitting `mod + a` and unselecting widgets - modal: correct popup title color - options: allow `midi:port_name` pairs in `--send` option + - sidepanel/state: opening a state file now properly sets it as the next default save location - widgets: - **new** `menu` widget, circular alternative to the dropdown & switch widgets - file: allow selecting folders diff --git a/src/client/app/ipc/callbacks.js b/src/client/app/ipc/callbacks.js index d0b544a3..36914248 100644 --- a/src/client/app/ipc/callbacks.js +++ b/src/client/app/ipc/callbacks.js @@ -55,7 +55,7 @@ module.exports = { stateLoad: function(data){ - state.load(data.state, data.send) + state.load(data.state, data.send, data.path) }, diff --git a/src/client/app/managers/state.js b/src/client/app/managers/state.js index 7045ebcd..ce2f4f5e 100644 --- a/src/client/app/managers/state.js +++ b/src/client/app/managers/state.js @@ -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 } diff --git a/src/server/callbacks.js b/src/server/callbacks.js index 9ec9f82e..47f0d865 100644 --- a/src/server/callbacks.js +++ b/src/server/callbacks.js @@ -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) })