Skip to content
This repository has been archived by the owner on Mar 3, 2023. It is now read-only.

Commit

Permalink
Use Electron Packager's hostArch() instead of process.arch due to arm…
Browse files Browse the repository at this point in the history
…v7l handling
  • Loading branch information
malept committed Feb 8, 2018
1 parent 1e08779 commit 539ba5d
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions script/lib/package-application.js
Expand Up @@ -4,12 +4,14 @@ const assert = require('assert')
const childProcess = require('child_process')
const electronPackager = require('electron-packager')
const fs = require('fs-extra')
const hostArch = require('electron-packager/targets').hostArch
const includePathInPackagedApp = require('./include-path-in-packaged-app')
const getLicenseText = require('./get-license-text')
const path = require('path')
const spawnSync = require('./spawn-sync')

const CONFIG = require('../config')
const HOST_ARCH = hostArch()

module.exports = function () {
const appName = getAppName()
Expand All @@ -18,7 +20,7 @@ module.exports = function () {
appBundleId: 'com.github.atom',
appCopyright: `Copyright © 2014-${(new Date()).getFullYear()} GitHub, Inc. All rights reserved.`,
appVersion: CONFIG.appMetadata.version,
arch: process.platform === 'darwin' ? 'x64' : process.arch, // OS X is 64-bit only
arch: process.platform === 'darwin' ? 'x64' : HOST_ARCH, // OS X is 64-bit only
asar: {unpack: buildAsarUnpackGlobExpression()},
buildVersion: CONFIG.appMetadata.version,
download: {cache: CONFIG.electronDownloadPath},
Expand Down Expand Up @@ -140,21 +142,21 @@ function renamePackagedAppDir (packageOutputDirPath) {
} else if (process.platform === 'linux') {
const appName = CONFIG.channel === 'beta' ? 'atom-beta' : 'atom'
let architecture
if (process.arch === 'ia32') {
if (HOST_ARCH === 'ia32') {
architecture = 'i386'
} else if (process.arch === 'x64') {
} else if (HOST_ARCH === 'x64') {
architecture = 'amd64'
} else {
architecture = process.arch
architecture = HOST_ARCH
}
packagedAppPath = path.join(CONFIG.buildOutputPath, `${appName}-${CONFIG.appMetadata.version}-${architecture}`)
if (fs.existsSync(packagedAppPath)) fs.removeSync(packagedAppPath)
fs.renameSync(packageOutputDirPath, packagedAppPath)
} else {
const appName = CONFIG.channel === 'beta' ? 'Atom Beta' : 'Atom'
packagedAppPath = path.join(CONFIG.buildOutputPath, appName)
if (process.platform === 'win32' && process.arch !== 'ia32') {
packagedAppPath += ` ${process.arch}`
if (process.platform === 'win32' && HOST_ARCH !== 'ia32') {
packagedAppPath += ` ${HOST_ARCH}`
}
if (fs.existsSync(packagedAppPath)) fs.removeSync(packagedAppPath)
fs.renameSync(packageOutputDirPath, packagedAppPath)
Expand Down

0 comments on commit 539ba5d

Please sign in to comment.