main: --custom-module: consolidate path containing whitespaces (#466)
This commit is contained in:
parent
b06e4d73c0
commit
85962b1452
2 changed files with 11 additions and 1 deletions
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
- bug fixes
|
||||
- broken `--remote-saving` option
|
||||
- allow whitespaces in path for `--custom-module`
|
||||
|
||||
## 0.41.3
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
})(),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue