diff options
author | Florrie <towerofnix@gmail.com> | 2020-02-04 22:57:28 -0400 |
---|---|---|
committer | Florrie <towerofnix@gmail.com> | 2020-02-04 22:57:28 -0400 |
commit | 8cbae1fe17bbf51060734861540a398631635ad7 (patch) | |
tree | ece8c93d64b981c7e7b9ae67d59cd88b79d274e4 | |
parent | 54c0ae40e4cb05f055bd3f7e195bc9308aee2e73 (diff) |
more os.homedir()
-rw-r--r-- | backend.js | 3 | ||||
-rw-r--r-- | downloaders.js | 4 | ||||
-rw-r--r-- | guess.js | 3 |
3 files changed, 6 insertions, 4 deletions
diff --git a/backend.js b/backend.js index 7ee6873..379a16b 100644 --- a/backend.js +++ b/backend.js @@ -7,6 +7,7 @@ const { getDownloaderFor } = require('./downloaders') const { getMetadataReaderFor } = require('./metadata-readers') const { getPlayer } = require('./players') const RecordStore = require('./record-store') +const os = require('os') const { getTimeStringsFromSec, @@ -568,7 +569,7 @@ class Backend extends EventEmitter { this.throttleMetadata = throttlePromise(10) this.metadataDictionary = {} - this.rootDirectory = process.env.HOME + '/.mtui' + this.rootDirectory = os.homedir() + '/.mtui' this.metadataPath = this.rootDirectory + '/track-metadata.json' } diff --git a/downloaders.js b/downloaders.js index 4c1ce38..e18c8e0 100644 --- a/downloaders.js +++ b/downloaders.js @@ -6,6 +6,7 @@ const mkdirp = promisify(require('mkdirp')) const fs = require('fs') const fetch = require('node-fetch') const tempy = require('tempy') +const os = require('os') const path = require('path') const sanitize = require('sanitize-filename') @@ -104,8 +105,7 @@ const removeFileProtocol = arg => { const downloaders = { extension: 'mp3', // Generally target file extension, used by youtube-dl - // TODO: Cross-platform stuff - rootCacheDir: process.env.HOME + '/.mtui/downloads', + rootCacheDir: os.homedir() + '/.mtui/downloads', http: cachify('http', arg => { diff --git a/guess.js b/guess.js index 56c614a..0748ce8 100644 --- a/guess.js +++ b/guess.js @@ -1,6 +1,7 @@ 'use strict' const Backend = require('./backend') +const os = require('os') const processSmartPlaylist = require('./smart-playlist') const { @@ -46,7 +47,7 @@ async function game() { } }) - const sourcePath = process.argv[2] || process.env.HOME + '/Music' + const sourcePath = process.argv[2] || os.homedir() + '/Music' let grouplike = {source: ['crawl-local', sourcePath]} grouplike = await processSmartPlaylist(grouplike) |