diff --git a/.travis.yml b/.travis.yml index c7985b53..aced9360 100644 --- a/.travis.yml +++ b/.travis.yml @@ -30,14 +30,14 @@ before_deploy: - npm run package -- --all - PLATFORM=darwin;ARCH=arm64; npm run package - npm run package-node - - cd $TRAVIS_BUILD_DIR/dist/open-stage-control-linux-x64/resources/app/server/ - - wget https://github.com/jean-emmanuel/open-stage-control-midi/releases/latest/download/osc-midi-linux && chmod +x osc-midi-linux && echo "true" > osc-midi.json - - cd $TRAVIS_BUILD_DIR/dist/open-stage-control-win32-x64/resources/app/server/ - - wget https://github.com/jean-emmanuel/open-stage-control-midi/releases/latest/download/osc-midi-windows.exe && chmod +x osc-midi-windows.exe && echo "true" > osc-midi.json - - cd $TRAVIS_BUILD_DIR/dist/open-stage-control-darwin-x64/open-stage-control.app/Contents/Resources/app/server - - wget https://github.com/jean-emmanuel/open-stage-control-midi/releases/latest/download/osc-midi-osx && chmod +x osc-midi-osx && echo "true" > osc-midi.json - - cd $TRAVIS_BUILD_DIR/dist/open-stage-control-darwin-arm64/open-stage-control.app/Contents/Resources/app/server - - wget https://github.com/jean-emmanuel/open-stage-control-midi/releases/latest/download/osc-midi-osx && chmod +x osc-midi-osx && echo "true" > osc-midi.json + - cd $TRAVIS_BUILD_DIR/dist/open-stage-control-linux-x64/resources/app/server/python + - wget https://github.com/jean-emmanuel/open-stage-control-midi/releases/latest/download/osc-midi-linux && chmod +x osc-midi-linux && echo "true" > .expect-midi-bin + - cd $TRAVIS_BUILD_DIR/dist/open-stage-control-win32-x64/resources/app/server/python + - wget https://github.com/jean-emmanuel/open-stage-control-midi/releases/latest/download/osc-midi-windows.exe && chmod +x osc-midi-windows.exe && echo "true" > .expect-midi-bin + - cd $TRAVIS_BUILD_DIR/dist/open-stage-control-darwin-x64/open-stage-control.app/Contents/Resources/app/server/python + - wget https://github.com/jean-emmanuel/open-stage-control-midi/releases/latest/download/osc-midi-osx && chmod +x osc-midi-osx && echo "true" > .expect-midi-bin + - cd $TRAVIS_BUILD_DIR/dist/open-stage-control-darwin-arm64/open-stage-control.app/Contents/Resources/app/server/python + - wget https://github.com/jean-emmanuel/open-stage-control-midi/releases/latest/download/osc-midi-osx && chmod +x osc-midi-osx && echo "true" > .expect-midi-bin - cd $TRAVIS_BUILD_DIR - mkdir dist/packages - npm run deb64 diff --git a/src/server/node/midi.js b/src/server/node/midi.js index 0a6c5990..ebd70546 100644 --- a/src/server/node/midi.js +++ b/src/server/node/midi.js @@ -3,10 +3,8 @@ import fs from 'fs' import path from 'path' import * as settings from './settings' -var pythonOptions = { - scriptPath:__dirname, - mode:'text', -} + +var scriptPath = path.resolve(__dirname, '../python') var midiBinaries = { x64: { @@ -19,12 +17,12 @@ var midiBinaries = { } } -var expectMidiBinaries = fs.existsSync(path.join(__dirname, '/osc-midi.json')), +var expectMidiBinaries = fs.existsSync(path.resoluve(scriptPath, '/.expect-midi-bin')), expectMidiBinariesError = false var pythonPathOverride if (midiBinaries[process.arch] && midiBinaries[process.arch][process.platform]) { - var p = path.resolve(__dirname,midiBinaries[process.arch][process.platform]) + var p = path.resolve(scriptPath, midiBinaries[process.arch][process.platform]) if (fs.existsSync(p)) { pythonPathOverride = p } else if (expectMidiBinaries) { @@ -45,7 +43,7 @@ class MidiConverter { ...settings.read('midi') ], pythonPath: MidiConverter.getPythonPath() - }, pythonOptions)) + }, {scriptPath, mode:'text'})) this.py.childProcess.on('error', (e)=>{ if (e.code === 'ENOENT') { @@ -126,7 +124,7 @@ class MidiConverter { if (expectMidiBinariesError) MidiConverter.midiBinariesError() - PythonShell.run('python/midi.py', Object.assign({pythonPath: MidiConverter.getPythonPath(), args: ['--params', 'list-only']}, pythonOptions), function(e, results) { + PythonShell.run('python/midi.py', Object.assign({pythonPath: MidiConverter.getPythonPath(), args: ['--params', 'list-only']}, {scriptPath, mode:'text'}), function(e, results) { if (e) { if (e.code === 'ENOENT') { console.error(`(ERROR, MIDI) Could not find python binary: ${e.message.replace(/spawn (.*) ENOENT/, '$1')}`)