Windows Portable App (#417)
* packager: call callbacks consistently Before this, the callbacks would not being called, which would lead to an incomplete build on non-OS X platforms when trying to build all for all platforms. * packager: Always produce OS X update file regardless of --package option This makes it consistent with how the windows build always produces the .nupkg autoupdate files * packager: fix duplicate npm install Move "npm prune && npm dedupe" into the release script. Remove an extra "npm install" * Make Windows portable app When a folder named "Portable Settings" exists in same folder as WebTorrent.exe, then use it instead of the default application config path. Closes #358 * packager: remove redundant signing warning * cross platform zip function * Set config file path to match config.CONFIG_PATH * portable app: make electron settings portable * portable: fix poster/torrent paths * use cross-zip * portable app: default download folder inside 'Portable Settings'
This commit is contained in:
26
config.js
26
config.js
@@ -1,10 +1,13 @@
|
||||
var applicationConfigPath = require('application-config-path')
|
||||
var appConfig = require('application-config')('WebTorrent')
|
||||
var path = require('path')
|
||||
var pathExists = require('path-exists')
|
||||
|
||||
var APP_NAME = 'WebTorrent'
|
||||
var APP_TEAM = 'The WebTorrent Project'
|
||||
var APP_VERSION = require('./package.json').version
|
||||
|
||||
var PORTABLE_PATH = path.join(path.dirname(process.execPath), 'Portable Settings')
|
||||
|
||||
module.exports = {
|
||||
APP_COPYRIGHT: 'Copyright © 2014-2016 ' + APP_TEAM,
|
||||
APP_FILE_ICON: path.join(__dirname, 'static', 'WebTorrentFile'),
|
||||
@@ -14,19 +17,20 @@ module.exports = {
|
||||
APP_VERSION: APP_VERSION,
|
||||
APP_WINDOW_TITLE: APP_NAME + ' (BETA)',
|
||||
|
||||
AUTO_UPDATE_CHECK_STARTUP_DELAY: 5 * 1000 /* 5 seconds */,
|
||||
AUTO_UPDATE_URL: 'https://webtorrent.io/desktop/update' +
|
||||
'?version=' + APP_VERSION + '&platform=' + process.platform,
|
||||
AUTO_UPDATE_CHECK_STARTUP_DELAY: 5 * 1000 /* 5 seconds */,
|
||||
|
||||
CRASH_REPORT_URL: 'https://webtorrent.io/desktop/crash-report',
|
||||
|
||||
CONFIG_PATH: applicationConfigPath(APP_NAME),
|
||||
CONFIG_POSTER_PATH: path.join(applicationConfigPath(APP_NAME), 'Posters'),
|
||||
CONFIG_TORRENT_PATH: path.join(applicationConfigPath(APP_NAME), 'Torrents'),
|
||||
CONFIG_PATH: getConfigPath(),
|
||||
CONFIG_POSTER_PATH: path.join(getConfigPath(), 'Posters'),
|
||||
CONFIG_TORRENT_PATH: path.join(getConfigPath(), 'Torrents'),
|
||||
|
||||
GITHUB_URL: 'https://github.com/feross/webtorrent-desktop',
|
||||
GITHUB_URL_RAW: 'https://raw.githubusercontent.com/feross/webtorrent-desktop/master',
|
||||
|
||||
IS_PORTABLE: isPortable(),
|
||||
IS_PRODUCTION: isProduction(),
|
||||
|
||||
ROOT_PATH: __dirname,
|
||||
@@ -40,6 +44,18 @@ module.exports = {
|
||||
WINDOW_MIN_WIDTH: 425
|
||||
}
|
||||
|
||||
function getConfigPath () {
|
||||
if (isPortable()) {
|
||||
return PORTABLE_PATH
|
||||
} else {
|
||||
return path.dirname(appConfig.filePath)
|
||||
}
|
||||
}
|
||||
|
||||
function isPortable () {
|
||||
return process.platform === 'win32' && isProduction() && pathExists(PORTABLE_PATH)
|
||||
}
|
||||
|
||||
function isProduction () {
|
||||
if (!process.versions.electron) {
|
||||
return false
|
||||
|
||||
Reference in New Issue
Block a user