main: --custom-module: consolidate path containing whitespaces (#466)

This commit is contained in:
jean-emmanuel 2019-02-01 11:18:14 +01:00
parent b06e4d73c0
commit 85962b1452
2 changed files with 11 additions and 1 deletions

View file

@ -4,6 +4,7 @@
- bug fixes
- broken `--remote-saving` option
- allow whitespaces in path for `--custom-module`
## 0.41.3

View file

@ -20,11 +20,20 @@ class OscServer {
var customModule = settings.read('customModule')
if (!customModule) return false
// consolidate path containing whitespaces
if (!customModule[0].includes('.js')) {
var index = customModule.findIndex(x => typeof x === 'string' && x.includes('.js'))
if (index !== undefined) {
var path = customModule.slice(0, index + 1).join(' ')
customModule.splice(0, index + 1, path)
}
}
var file = (()=>{
try {
return fs.readFileSync(customModule[0], 'utf8')
} catch(err) {
console.log('CustomModule Error: File not found: ' + settings.read('customModule'))
console.log('CustomModule Error: File not found: ' + customModule[0])
return false
}
})(),