Make Portable App also a Silent App

Fixes two portable app bugs, to make the app fully "silent", not just
"portable". This means that not only are all data files stored in the
"Portable Settings" folder, but the app should leave no trace on the
host system.

- Disable Electron's single instance mode so no lock file is created in
"%APPDATA%\Roaming\WebTorrent".

- Put Electron crash files, and other electron files into the "Portable
Settings\Temp" folder instead of "%APPDATA%\Temp".
This commit is contained in:
Feross Aboukhadijeh
2016-09-27 16:49:22 -07:00
parent 7dcddf90e9
commit b3ec61ddd8
3 changed files with 20 additions and 7 deletions

View File

@@ -116,9 +116,7 @@ function getConfigPath () {
}
function getDefaultDownloadPath () {
if (!process || !process.type) {
return ''
} else if (IS_PORTABLE) {
if (IS_PORTABLE) {
return path.join(getConfigPath(), 'Downloads')
} else {
return getPath('downloads')
@@ -126,9 +124,14 @@ function getDefaultDownloadPath () {
}
function getPath (key) {
if (process.type === 'renderer') {
if (!process.versions.electron) {
// Node.js process
return ''
} else if (process.type === 'renderer') {
// Electron renderer process
return electron.remote.app.getPath(key)
} else {
// Electron main process
return electron.app.getPath(key)
}
}
@@ -159,6 +162,7 @@ function isPortable () {
function isProduction () {
if (!process.versions.electron) {
// Node.js process
return false
}
if (process.platform === 'darwin') {