Remove extra filesystem dependencies

This commit is contained in:
DC
2016-04-16 20:59:02 -07:00
parent 2693075f9f
commit 06f81ff759
4 changed files with 10 additions and 15 deletions

View File

@@ -242,8 +242,7 @@ function uninstallWin32 () {
}
function installLinux () {
var fs = require('fs')
var mkdirp = require('mkdirp')
var fs = require('fs-extra')
var os = require('os')
var path = require('path')
@@ -277,7 +276,7 @@ function installLinux () {
'applications',
'webtorrent-desktop.desktop'
)
mkdirp(path.dirname(desktopFilePath))
fs.mkdirp(path.dirname(desktopFilePath))
fs.writeFile(desktopFilePath, desktopFile, function (err) {
if (err) return log.error(err.message)
})
@@ -298,7 +297,7 @@ function installLinux () {
'icons',
'webtorrent-desktop.png'
)
mkdirp(path.dirname(iconFilePath))
fs.mkdirp(path.dirname(iconFilePath))
fs.writeFile(iconFilePath, iconFile, function (err) {
if (err) return log.error(err.message)
})
@@ -308,7 +307,7 @@ function installLinux () {
function uninstallLinux () {
var os = require('os')
var path = require('path')
var rimraf = require('rimraf')
var fs = require('fs-extra')
var desktopFilePath = path.join(
os.homedir(),
@@ -317,7 +316,7 @@ function uninstallLinux () {
'applications',
'webtorrent-desktop.desktop'
)
rimraf.sync(desktopFilePath)
fs.removeSync(desktopFilePath)
var iconFilePath = path.join(
os.homedir(),
@@ -326,5 +325,5 @@ function uninstallLinux () {
'icons',
'webtorrent-desktop.png'
)
rimraf.sync(iconFilePath)
fs.removeSync(iconFilePath)
}

View File

@@ -7,7 +7,6 @@ var electron = require('electron')
var fs = require('fs')
var os = require('os')
var path = require('path')
var pathExists = require('path-exists')
var app = electron.app
@@ -118,7 +117,8 @@ function updateShortcuts (cb) {
var desktopShortcutPath = path.join(homeDir, 'Desktop', 'WebTorrent.lnk')
// Check if the desktop shortcut has been previously deleted and and keep it deleted
// if it was
pathExists(desktopShortcutPath).then(function (desktopShortcutExists) {
fs.access(desktopShortcutPath, function (err) {
var desktopShortcutExists = !err
createShortcuts(function () {
if (desktopShortcutExists) {
cb()

View File

@@ -29,12 +29,9 @@
"hyperx": "^2.0.2",
"languagedetect": "^1.1.1",
"main-loop": "^3.2.0",
"mkdirp": "^0.5.1",
"musicmetadata": "^2.0.2",
"network-address": "^1.1.0",
"path-exists": "^2.1.0",
"prettier-bytes": "^1.0.1",
"rimraf": "^2.5.2",
"simple-get": "^2.0.0",
"srt-to-vtt": "^1.1.1",
"upload-element": "^1.0.1",

View File

@@ -6,8 +6,7 @@ var WebTorrent = require('webtorrent')
var defaultAnnounceList = require('create-torrent').announceList
var deepEqual = require('deep-equal')
var electron = require('electron')
var fs = require('fs')
var mkdirp = require('mkdirp')
var fs = require('fs-extra')
var musicmetadata = require('musicmetadata')
var networkAddress = require('network-address')
var path = require('path')
@@ -192,7 +191,7 @@ function generateTorrentPoster (torrentKey) {
torrentPoster(torrent, function (err, buf, extension) {
if (err) return console.log('error generating poster: %o', err)
// save it for next time
mkdirp(config.CONFIG_POSTER_PATH, function (err) {
fs.mkdirp(config.CONFIG_POSTER_PATH, function (err) {
if (err) return console.log('error creating poster dir: %o', err)
var posterFileName = torrent.infoHash + extension
var posterFilePath = path.join(config.CONFIG_POSTER_PATH, posterFileName)