Merge pull request #954 from omrilitov/master
use arch to determine OS_SYSARCH
This commit is contained in:
@@ -16,6 +16,7 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"airplayer": "^2.0.0",
|
"airplayer": "^2.0.0",
|
||||||
"application-config": "^1.0.0",
|
"application-config": "^1.0.0",
|
||||||
|
"arch": "^2.0.0",
|
||||||
"auto-launch": "^4.0.1",
|
"auto-launch": "^4.0.1",
|
||||||
"bitfield": "^1.0.2",
|
"bitfield": "^1.0.2",
|
||||||
"capture-frame": "^1.0.0",
|
"capture-frame": "^1.0.0",
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ const appConfig = require('application-config')('WebTorrent')
|
|||||||
const fs = require('fs')
|
const fs = require('fs')
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
const electron = require('electron')
|
const electron = require('electron')
|
||||||
|
const arch = require('arch')
|
||||||
|
|
||||||
const APP_NAME = 'WebTorrent'
|
const APP_NAME = 'WebTorrent'
|
||||||
const APP_TEAM = 'WebTorrent, LLC'
|
const APP_TEAM = 'WebTorrent, LLC'
|
||||||
@@ -84,7 +85,7 @@ module.exports = {
|
|||||||
IS_PRODUCTION: IS_PRODUCTION,
|
IS_PRODUCTION: IS_PRODUCTION,
|
||||||
IS_TEST: IS_TEST,
|
IS_TEST: IS_TEST,
|
||||||
|
|
||||||
OS_SYSARCH: is64BitOperatingSystem() ? 'x64' : 'ia32',
|
OS_SYSARCH: arch().replace('x86', 'ia32'),
|
||||||
|
|
||||||
POSTER_PATH: path.join(getConfigPath(), 'Posters'),
|
POSTER_PATH: path.join(getConfigPath(), 'Posters'),
|
||||||
ROOT_PATH: path.join(__dirname, '..'),
|
ROOT_PATH: path.join(__dirname, '..'),
|
||||||
@@ -161,32 +162,3 @@ function isProduction () {
|
|||||||
return !/\/electron$/.test(process.execPath)
|
return !/\/electron$/.test(process.execPath)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the operating system's CPU architecture. This is different than
|
|
||||||
* `process.arch` which returns the architecture the binary was compiled for.
|
|
||||||
*
|
|
||||||
* On Windows, the most reliable way to detect a 64-bit OS from within a 32-bit
|
|
||||||
* app is based on the presence of a WOW64 file: %SystemRoot%\SysNative.
|
|
||||||
*
|
|
||||||
* Background: https://twitter.com/feross/status/776949077208510464
|
|
||||||
*/
|
|
||||||
function is64BitOperatingSystem () {
|
|
||||||
// This is a 64-bit binary, so the OS clearly supports 64-bit apps
|
|
||||||
if (process.arch === 'x64') return true
|
|
||||||
|
|
||||||
let useEnv = false
|
|
||||||
try {
|
|
||||||
useEnv = !!(process.env.SYSTEMROOT && fs.statSync(process.env.SYSTEMROOT))
|
|
||||||
} catch (err) {}
|
|
||||||
|
|
||||||
let sysRoot = useEnv ? process.env.SYSTEMROOT : 'C:\\Windows'
|
|
||||||
|
|
||||||
// If %SystemRoot%\SysNative exists, we are in a WOW64 FS Redirected application.
|
|
||||||
let isWOW64 = false
|
|
||||||
try {
|
|
||||||
isWOW64 = !!fs.statSync(path.join(sysRoot, 'sysnative'))
|
|
||||||
} catch (err) {}
|
|
||||||
|
|
||||||
return isWOW64
|
|
||||||
}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user