Skip to content

Commit 01604cf

Browse files
black-snowdevelar
authored andcommitted
feat: 32 bit appx
1 parent 1aaeb30 commit 01604cf

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

src/targets/appx.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,21 +55,21 @@ export default class AppXTarget extends Target {
5555
return copy(path.join(templatePath, "assets", `SampleAppx.${size}.png`), target)
5656
}),
5757
copyDir(appOutDir, path.join(preAppx, "app")),
58-
this.writeManifest(templatePath, preAppx, safeName)
58+
this.writeManifest(templatePath, preAppx, safeName, arch)
5959
])
6060

6161
const destination = path.join(this.outDir, packager.generateName("appx", arch, false))
6262
const args = ["pack", "/o", "/d", preAppx, "/p", destination]
6363
use(this.options.makeappxArgs, (it: Array<string>) => args.push(...it))
6464
// wine supports only ia32 binary in any case makeappx crashed on wine
6565
// await execWine(path.join(await getSignVendorPath(), "windows-10", process.platform === "win32" ? process.arch : "ia32", "makeappx.exe"), args)
66-
await spawn(path.join(await getSignVendorPath(), "windows-10", process.arch, "makeappx.exe"), args)
66+
await spawn(path.join(await getSignVendorPath(), "windows-10", arch === Arch.ia32 ? "ia32" : "x64", "makeappx.exe"), args)
6767

6868
await packager.sign(destination)
6969
packager.dispatchArtifactCreated(destination, packager.generateName("appx", arch, true))
7070
}
7171

72-
private async writeManifest(templatePath: string, preAppx: string, safeName: string) {
72+
private async writeManifest(templatePath: string, preAppx: string, safeName: string, arch: Arch) {
7373
const appInfo = this.packager.appInfo
7474
const manifest = (await readFile(path.join(templatePath, "appxmanifest.xml"), "utf8"))
7575
.replace(/\$\{([a-zA-Z]+)\}/g, (match, p1): string => {
@@ -100,11 +100,14 @@ export default class AppXTarget extends Target {
100100

101101
case "safeName":
102102
return safeName
103+
104+
case "arch":
105+
return arch === Arch.ia32 ? "x86" : "x64"
103106

104107
default:
105108
throw new Error(`Macro ${p1} is not defined`)
106109
}
107110
})
108111
await writeFile(path.join(preAppx, "appxmanifest.xml"), manifest)
109112
}
110-
}
113+
}

templates/appx/appxmanifest.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10"
55
xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities">
66
<Identity Name="${name}"
7-
ProcessorArchitecture="x64"
7+
ProcessorArchitecture="${arch}"
88
Publisher="${publisher}"
99
Version="${version}" />
1010
<Properties>
@@ -34,4 +34,4 @@
3434
</uap:VisualElements>
3535
</Application>
3636
</Applications>
37-
</Package>
37+
</Package>

0 commit comments

Comments
 (0)