Merge pull request #974 from feross/feross/portable
Fix Windows Portable App mode
This commit is contained in:
@@ -12,8 +12,8 @@ const IS_TEST = isTest()
|
|||||||
const PORTABLE_PATH = IS_TEST
|
const PORTABLE_PATH = IS_TEST
|
||||||
? path.join(process.platform === 'win32' ? 'C:\\Windows\\Temp' : '/tmp', 'WebTorrentTest')
|
? path.join(process.platform === 'win32' ? 'C:\\Windows\\Temp' : '/tmp', 'WebTorrentTest')
|
||||||
: path.join(path.dirname(process.execPath), 'Portable Settings')
|
: path.join(path.dirname(process.execPath), 'Portable Settings')
|
||||||
const IS_PORTABLE = isPortable()
|
|
||||||
const IS_PRODUCTION = isProduction()
|
const IS_PRODUCTION = isProduction()
|
||||||
|
const IS_PORTABLE = isPortable()
|
||||||
|
|
||||||
const UI_HEADER_HEIGHT = 38
|
const UI_HEADER_HEIGHT = 38
|
||||||
const UI_TORRENT_HEIGHT = 100
|
const UI_TORRENT_HEIGHT = 100
|
||||||
@@ -141,11 +141,18 @@ function isPortable () {
|
|||||||
if (IS_TEST) {
|
if (IS_TEST) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
try {
|
|
||||||
return process.platform === 'win32' && IS_PRODUCTION && !!fs.statSync(PORTABLE_PATH)
|
if (process.platform !== 'win32' || !IS_PRODUCTION) {
|
||||||
} catch (err) {
|
// Fast path: Non-Windows platforms should not check for path on disk
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let portablePathExists = false
|
||||||
|
try {
|
||||||
|
portablePathExists = !!fs.statSync(PORTABLE_PATH)
|
||||||
|
} catch (err) {}
|
||||||
|
|
||||||
|
return portablePathExists
|
||||||
}
|
}
|
||||||
|
|
||||||
function isProduction () {
|
function isProduction () {
|
||||||
|
|||||||
Reference in New Issue
Block a user