remote-save: let the server notify the client if it worked or not
This commit is contained in:
parent
5374a91325
commit
8c59676e2b
3 changed files with 35 additions and 22 deletions
|
|
@ -126,7 +126,6 @@ module.exports = {
|
|||
ipc.clients[clientId].sessionPath = data.path
|
||||
if (!settings.read('readOnly')) {
|
||||
this.sessionAddToHistory(data.path)
|
||||
ipc.send('sessionAllowRemoteSave', true, clientId)
|
||||
}
|
||||
})
|
||||
|
||||
|
|
@ -134,13 +133,19 @@ module.exports = {
|
|||
|
||||
sessionSave: function(data, clientId) {
|
||||
|
||||
var path = ipc.clients[clientId].sessionPath
|
||||
var path = ipc.clients[clientId].sessionPath,
|
||||
error
|
||||
|
||||
if (path) {
|
||||
|
||||
fs.writeFile(path, data, function(err, data) {
|
||||
if (err) throw err
|
||||
if (err) return error = err
|
||||
console.log('Session file saved in '+ path)
|
||||
ipc.send('sessionSaved', clientId)
|
||||
ipc.send('notify', {
|
||||
icon: 'save',
|
||||
locale: 'session_savesuccess'
|
||||
}, clientId)
|
||||
for (var id in ipc.clients) {
|
||||
if (id !== clientId && ipc.clients[id].sessionPath === path) {
|
||||
module.exports.sessionOpen({path: path}, id)
|
||||
|
|
@ -150,6 +155,16 @@ module.exports = {
|
|||
|
||||
}
|
||||
|
||||
if (!path || error) {
|
||||
|
||||
ipc.send('notify', {
|
||||
class: 'error',
|
||||
locale: 'session_saveerror',
|
||||
message: error
|
||||
}, clientId)
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
syncOsc: function(shortdata, clientId) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue