fixes for standard v10
This commit is contained in:
@@ -17,8 +17,8 @@ let proc = null
|
||||
function checkInstall (playerPath, cb) {
|
||||
// check for VLC if external player has not been specified by the user
|
||||
// otherwise assume the player is installed
|
||||
if (playerPath == null) return vlcCommand((err) => cb(!err))
|
||||
process.nextTick(() => cb(true))
|
||||
if (playerPath == null) return vlcCommand(cb)
|
||||
process.nextTick(() => cb(null))
|
||||
}
|
||||
|
||||
function spawn (playerPath, url, title) {
|
||||
|
||||
@@ -166,8 +166,8 @@ function init () {
|
||||
ipc.on('checkForExternalPlayer', function (e, path) {
|
||||
const externalPlayer = require('./external-player')
|
||||
|
||||
externalPlayer.checkInstall(path, function (isInstalled) {
|
||||
windows.main.send('checkForExternalPlayer', isInstalled)
|
||||
externalPlayer.checkInstall(path, function (err) {
|
||||
windows.main.send('checkForExternalPlayer', !err)
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
@@ -36,8 +36,8 @@ function setWindowFocus (flag) {
|
||||
}
|
||||
|
||||
function initLinux () {
|
||||
checkLinuxTraySupport(function (supportsTray) {
|
||||
if (supportsTray) createTray()
|
||||
checkLinuxTraySupport(function (err) {
|
||||
if (!err) createTray()
|
||||
})
|
||||
}
|
||||
|
||||
@@ -55,10 +55,14 @@ function checkLinuxTraySupport (cb) {
|
||||
// libappindicator1. If WebTorrent was installed from the deb file, we should
|
||||
// always have it. If it was installed from the zip file, we might not.
|
||||
cp.exec('dpkg --get-selections libappindicator1', function (err, stdout) {
|
||||
if (err) return cb(false)
|
||||
if (err) return cb(err)
|
||||
// Unfortunately there's no cleaner way, as far as I can tell, to check
|
||||
// whether a debian package is installed:
|
||||
cb(stdout.endsWith('\tinstall\n'))
|
||||
if (stdout.endsWith('\tinstall\n')) {
|
||||
cb(null)
|
||||
} else {
|
||||
cb(new Error('debian package not installed'))
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -281,7 +281,7 @@ module.exports = class TorrentListController {
|
||||
|
||||
// Recursively finds {name, path, size} for all files in a folder
|
||||
// Calls `cb` on success, calls `onError` on failure
|
||||
function findFilesRecursive (paths, cb) {
|
||||
function findFilesRecursive (paths, cb_) {
|
||||
if (paths.length > 1) {
|
||||
let numComplete = 0
|
||||
let ret = []
|
||||
@@ -290,7 +290,7 @@ function findFilesRecursive (paths, cb) {
|
||||
ret.push(...fileObjs)
|
||||
if (++numComplete === paths.length) {
|
||||
ret.sort((a, b) => a.path < b.path ? -1 : a.path > b.path)
|
||||
cb(ret)
|
||||
cb_(ret)
|
||||
}
|
||||
})
|
||||
})
|
||||
@@ -304,7 +304,7 @@ function findFilesRecursive (paths, cb) {
|
||||
// Files: return name, path, and size
|
||||
if (!stat.isDirectory()) {
|
||||
const filePath = fileOrFolder
|
||||
return cb([{
|
||||
return cb_([{
|
||||
name: path.basename(filePath),
|
||||
path: filePath,
|
||||
size: stat.size
|
||||
@@ -316,7 +316,7 @@ function findFilesRecursive (paths, cb) {
|
||||
fs.readdir(folderPath, function (err, fileNames) {
|
||||
if (err) return dispatch('error', err)
|
||||
const paths = fileNames.map((fileName) => path.join(folderPath, fileName))
|
||||
findFilesRecursive(paths, cb)
|
||||
findFilesRecursive(paths, cb_)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user