Remove path-exists

This package trivially wraps core node.js functionality. Let's do
without it.
This commit is contained in:
Feross Aboukhadijeh
2016-05-09 16:59:57 +02:00
parent 18b126e0d2
commit 98e263e69a
3 changed files with 13 additions and 5 deletions

View File

@@ -5,9 +5,9 @@
* Useful for developers.
*/
var fs = require('fs')
var os = require('os')
var path = require('path')
var pathExists = require('path-exists')
var rimraf = require('rimraf')
var config = require('../config')
@@ -15,7 +15,12 @@ var handlers = require('../main/handlers')
rimraf.sync(config.CONFIG_PATH)
var tmpPath = path.join(pathExists.sync('/tmp') ? '/tmp' : os.tmpDir(), 'webtorrent')
var tmpPath
try {
tmpPath = path.join(fs.statSync('/tmp') && '/tmp', 'webtorrent')
} catch (err) {
tmpPath = path.join(os.tmpDir(), 'webtorrent')
}
rimraf.sync(tmpPath)
// Uninstall .torrent file and magnet link handlers

View File

@@ -1,6 +1,6 @@
var appConfig = require('application-config')('WebTorrent')
var fs = require('fs')
var path = require('path')
var pathExists = require('path-exists')
var APP_NAME = 'WebTorrent'
var APP_TEAM = 'The WebTorrent Project'
@@ -53,7 +53,11 @@ function getConfigPath () {
}
function isPortable () {
return process.platform === 'win32' && isProduction() && pathExists(PORTABLE_PATH)
try {
return process.platform === 'win32' && isProduction() && !!fs.statSync(PORTABLE_PATH)
} catch (err) {
return false
}
}
function isProduction () {

View File

@@ -31,7 +31,6 @@
"main-loop": "^3.2.0",
"musicmetadata": "^2.0.2",
"network-address": "^1.1.0",
"path-exists": "^2.1.0",
"prettier-bytes": "^1.0.1",
"simple-get": "^2.0.0",
"srt-to-vtt": "^1.1.1",