options: use existsSync to check files

This commit is contained in:
bordun 2020-04-25 13:35:55 +02:00
parent 2b529bc19d
commit 0d9832144d

View file

@ -9,17 +9,17 @@ module.exports = {
},
'l': {alias: 'load', type: 'string', file: {name: 'OSC Session (.json)', extensions: ['json', 'js']}, describe: 'session file to load',
check: (arg)=>{
return fs.lstatSync(arg) ? true : 'Session file not found: ' + arg
return fs.existsSync(arg) ? true : 'Session file not found: ' + arg
}
},
'state': {type: 'string', file: {name: 'OSC State (.state)', extensions: ['state']}, describe: 'state file to load',
check: (arg)=>{
return fs.lstatSync(arg) ? true : 'State file not found: ' + arg
return fs.existsSync(arg) ? true : 'State file not found: ' + arg
}
},
'c': {alias: 'custom-module', type: 'array', file: {name: 'OSC Custom module (.js)', extensions: ['js']}, describe: 'custom module file to load (custom options can be passed after the filename)',
check: (arg)=>{
return fs.lstatSync(arg[0]) ? true : 'Custom module file not found: ' + arg
return fs.existsSync(arg[0]) ? true : 'Custom module file not found: ' + arg
},
},
'p': {alias: 'port', type: 'number', describe: 'http port of the server (default to 8080)',