diff options
author | Florrie <towerofnix@gmail.com> | 2019-03-22 18:01:33 -0300 |
---|---|---|
committer | Florrie <towerofnix@gmail.com> | 2019-03-22 18:01:33 -0300 |
commit | 9652e73c5144939fb2aee9e0a3cffee9fc8249b0 (patch) | |
tree | f4ccb8f4f0ec68a2c02b42bffbc9d8b16421d7bb /native-app | |
parent | 15de6776a959c0b267b6f601417caf1f973b3b38 (diff) |
Auto-resolve path where possible
Diffstat (limited to 'native-app')
-rwxr-xr-x | native-app/index.js | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/native-app/index.js b/native-app/index.js index 2f174ea..16ef810 100755 --- a/native-app/index.js +++ b/native-app/index.js @@ -1,28 +1,24 @@ #!/usr/bin/env node -const basePath = '/home/florrie/Documents/interactive-bgm'; - -const logFile = basePath + '/native-app/log'; - -const log = msg => { - require('fs').appendFileSync(logFile, msg + '\n'); -}; - - -log('Started ' + Date()); - const { spawn } = require('child_process'); const EventEmitter = require('events'); const FIFO = require('fifo-js'); const http = require('http'); +const path = require('path'); +const fs = require('fs'); -log('Loaded modules'); +const basePath = path.resolve(__dirname, '..'); +const logFile = basePath + '/native-app/log'; +const log = msg => fs.appendFileSync(logFile, msg + '\n'); + +log('Started ' + Date()); class TrackPlayer { constructor(file) { this.file = file; this.volume = 0; this.storedVolume = this.volume; + log('Created track: ' + file); } loadProcess() { |