headless: browse session (had to change a bit the sessionopening to keep using the vm

This commit is contained in:
jean-emmanuel 2015-10-30 12:33:28 +01:00
parent daac2b4d01
commit e2ab8b60b7
3 changed files with 38 additions and 18 deletions

View file

@ -252,7 +252,7 @@ callbacks.browseSessions = function(data) {
dialog.showOpenDialog(window,{title:'Load session file',defaultPath:settings.read('sessionPath'),filters: [ { name: 'OSC Session file', extensions: ['js'] }]},function(file){
if (file==undefined) {return}
settings.write('sessionPath',file[0].replace(file[0].split('/').pop(),''))
callbacks.openSession(file[0])
callbacks.openSession({path:file[0]})
})
}
@ -275,7 +275,7 @@ callbacks.removeSessionFromHistory = function(data) {
}
callbacks.openSession = function(data,clientId) {
var file = fs.readFileSync(data,'utf8'),
var file = data.file || fs.readFileSync(data.path,'utf8'),
session,
error
@ -285,7 +285,12 @@ callbacks.openSession = function(data,clientId) {
error = err
}
ipc.send('openSession',{error:error,path:data,session:JSON.stringify(session)},clientId)
if (!error) {
if (data.path) callbacks.addSessionToHistory(data.path)
ipc.send('openSession',JSON.stringify(session),clientId)
} else {
ipc.send('error',{title:'Error: invalid session file',text:error})
}
}
callbacks.sendOsc = function(data) {