diff options
author | Alex <alxmorais8@msn.com> | 2019-08-12 16:52:33 +0300 |
---|---|---|
committer | Alex <alxmorais8@msn.com> | 2019-08-12 16:52:33 +0300 |
commit | 3ddb63c874c7ea24f27ff521f0ceef818f92084f (patch) | |
tree | 3e3b47725aacf9df4e7c2b3336800e6ce0cddee9 /test | |
parent | 35fc44f9b98d6970244a517a5a9ca6175a3b40f5 (diff) |
Small refactor common test function
Diffstat (limited to 'test')
-rw-r--r-- | test/common.js | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/test/common.js b/test/common.js index 8c30686..6f2ce1e 100644 --- a/test/common.js +++ b/test/common.js @@ -3,11 +3,11 @@ const fs = require('fs') const path = require('path') exports.getDownloadPath = function (infix, infoHash) { - let downloadPath + let tmpPath try { - downloadPath = path.join(fs.statSync('/tmp') && '/tmp', 'webtorrent', 'test') + tmpPath = path.join(fs.statSync('/tmp') && '/tmp') } catch (err) { - downloadPath = path.join(typeof os.tmpdir === 'function' ? os.tmpdir() : '/', 'webtorrent', 'test') + tmpPath = path.join(typeof os.tmpdir === 'function' ? os.tmpdir() : '/') } - return path.join(downloadPath, infix, infoHash) + return path.join(tmpPath, 'webtorrent', 'test', infix, infoHash) } |