launcher: accept json session files and print a deprecation warning in the console (issue #101)
This commit is contained in:
parent
2a319b85fb
commit
a941ac621b
3 changed files with 8 additions and 3 deletions
|
|
@ -63,10 +63,15 @@ module.exports = {
|
|||
},
|
||||
|
||||
sessionOpen: function(data,clientId) {
|
||||
|
||||
var file = data.file || (function(){try {return fs.readFileSync(data.path,'utf8')} catch(err) {return false}})(),
|
||||
error = file===false&&data.path?'Session file "' + data.path + '" not found.':false,
|
||||
session
|
||||
|
||||
if (data.path && data.path.split('.').pop() == 'js') {
|
||||
console.warn(`Warning: support for .js session files is deprecated, please use the .json extension instead`)
|
||||
}
|
||||
|
||||
try {
|
||||
session = vm.runInNewContext(file)
|
||||
} catch(err) {
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ $(document).ready(()=>{
|
|||
|
||||
browse.click(function(e){
|
||||
e.preventDefault()
|
||||
dialog.showOpenDialog({filters:[{name:'js',extensions:['js']}]},function(file){
|
||||
dialog.showOpenDialog({filters:[{name:option.file.name,extensions:option.file.extensions}]},function(file){
|
||||
input.val(file).change()
|
||||
})
|
||||
})
|
||||
|
|
|
|||
|
|
@ -13,9 +13,9 @@ var options = {
|
|||
true : 'Sync hosts must be ip:port pairs & port must be >= 1024'
|
||||
}
|
||||
},
|
||||
'l':{alias:'load',type:'string',file:'js',describe:'session file to load'},
|
||||
'l':{alias:'load',type:'string',file:{name:'OSC Session (.json)', extensions: ['json', 'js']},describe:'session file to load'},
|
||||
'b':{alias:'blank',type:'boolean',describe:'load a blank session and start the editor'},
|
||||
'c':{alias:'custom-module',type:'string',file:'js',describe:'custom module file to load'},
|
||||
'c':{alias:'custom-module',type:'string',file:{name:'OSC Custom module (.js)', extensions: ['js']},describe:'custom module file to load'},
|
||||
'p':{alias:'port',type:'number',describe:'http port of the server (default to 8080)',
|
||||
check: (p)=>{
|
||||
return (!isNaN(p) && p > 1023 && parseInt(p)===p) ?
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue