Skip to content

Commit 8d9b952

Browse files
committed
fix: win ia32 out dir name — unexpanded $arch
1 parent 079989a commit 8d9b952

File tree

4 files changed

+28
-11
lines changed

4 files changed

+28
-11
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
"bugs": "https://github.com/electron-userland/electron-builder/issues",
5757
"homepage": "https://github.com/electron-userland/electron-builder",
5858
"dependencies": {
59-
"7zip-bin": "^1.0.0",
59+
"7zip-bin": "^1.0.5",
6060
"asar": "^0.11.0",
6161
"bluebird": "^3.3.5",
6262
"chalk": "^1.1.3",

src/fpmDownload.ts

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { statOrNull, spawn, debug, debug7z } from "./util"
2-
import { writeFile, rename, remove } from "fs-extra-p"
2+
import { writeFile, rename, remove, stat, emptyDir } from "fs-extra-p"
33
import { download } from "./httpRequest"
44
import { path7za } from "7zip-bin"
55
import * as path from "path"
@@ -41,25 +41,31 @@ async function doDownloadFpm(version: string, osAndArch: string): Promise<string
4141
const cacheDir = path.join(homedir(), ".cache", "fpm")
4242
const fpmDir = path.join(cacheDir, dirName)
4343

44-
const stat = await statOrNull(fpmDir)
45-
if (stat != null && stat.isDirectory()) {
44+
const fpmDirStat = await statOrNull(fpmDir)
45+
if (fpmDirStat != null && fpmDirStat.isDirectory()) {
4646
debug(`Found existing fpm ${fpmDir}`)
4747
return path.join(fpmDir, "fpm")
4848
}
4949

5050
// 7z cannot be extracted from the input stream, temp file is required
5151
const tempName = getTempName()
52-
const archiveName = path.join(cacheDir, tempName + ".7z")
53-
debug(`Download fpm from ${url} to ${archiveName}`)
54-
await download(url, archiveName)
52+
const archiveName = path.join(cacheDir, `${tempName}.7z`)
5553
const tempUnpackDir = path.join(cacheDir, tempName)
56-
const args = ["x", archiveName, "-o" + tempName, "-bd"]
54+
debug(`Download fpm from ${url} to ${archiveName}`)
55+
await BluebirdPromise.all<any>([download(url, archiveName), emptyDir(tempUnpackDir)])
56+
57+
if (debug.enabled && (!(await stat(archiveName)).isFile())) {
58+
throw new Error(`${archiveName} was not downloaded correctly`)
59+
}
60+
61+
const args = ["x", archiveName, "-o" + tempUnpackDir, "-bd"]
5762
if (debug7z.enabled) {
5863
args.push("-bb3")
5964
}
6065
else if (!debug.enabled) {
6166
args.push("-bb0")
6267
}
68+
6369
await spawn(path7za, args, {
6470
cwd: cacheDir,
6571
stdio: ["ignore", debug.enabled ? "inherit" : "ignore", "inherit"],

src/winPackager.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ function isIco(buffer: Buffer): boolean {
230230
}
231231

232232
export function computeDistOut(outDir: string, arch: string): string {
233-
return path.join(outDir, "win" + (arch === "x64" ? "" : "-arch"))
233+
return path.join(outDir, `win${arch === "x64" ? "" : `-${arch}` }`)
234234
}
235235

236236
function checkConflictingOptions(options: any) {

test/src/winPackagerTest.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,24 @@ import ElectronPackagerOptions = ElectronPackager.ElectronPackagerOptions
1212
//noinspection JSUnusedLocalSymbols
1313
const __awaiter = require("out/awaiter")
1414

15-
test.ifNotCiOsx("win", () => assertPack("test-app-one", signed(platform(Platform.WINDOWS)),
15+
test.ifNotCiOsx("win", () => assertPack("test-app-one", signed({
16+
platform: [Platform.WINDOWS],
17+
arch: "all",
18+
}),
1619
{
1720
tempDirCreated: process.env.TEST_DELTA ? it => modifyPackageJson(it, data => {
1821
data.build.win = {
1922
remoteReleases: "https://github.com/develar/__test-app-releases",
2023
}
21-
}) : null
24+
}) : null,
25+
expectedArtifacts: [
26+
"RELEASES",
27+
"RELEASES",
28+
"TestApp Setup 1.1.0-ia32.exe",
29+
"TestApp Setup 1.1.0.exe",
30+
"TestApp-1.1.0-full.nupkg",
31+
"TestApp-1.1.0-full.nupkg"
32+
],
2233
}
2334
))
2435

0 commit comments

Comments
 (0)