From 85962b1452b6744b4bd253b3098d722c17769ecd Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Fri, 1 Feb 2019 11:18:14 +0100 Subject: [PATCH] main: --custom-module: consolidate path containing whitespaces (#466) --- CHANGELOG.md | 1 + src/server/osc/index.js | 11 ++++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dbf24dec..af7fd196 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ - bug fixes - broken `--remote-saving` option + - allow whitespaces in path for `--custom-module` ## 0.41.3 diff --git a/src/server/osc/index.js b/src/server/osc/index.js index 77452fe5..109e3ec7 100644 --- a/src/server/osc/index.js +++ b/src/server/osc/index.js @@ -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 } })(),