Skip to content

Commit

Permalink
fix(msi): Msi target separates files and subdirectories into differen…
Browse files Browse the repository at this point in the history
…t directories

Close #2272
  • Loading branch information
develar committed Apr 27, 2018
1 parent eb6e01a commit 7f75b45
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/electron-builder-lib/src/targets/MsiTarget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,10 +189,10 @@ export default class MsiTarget extends Target {
// This syntax is a shortcut to defining each directory in an individual Directory element.
dirName = packagePath.substring(0, lastSlash)
// add U (user) suffix just to be sure that will be not overwrite system WIX directory ids.
directoryId = `${dirName.toLowerCase()}_u`
directoryId = dirName.replace(path.sep === "/" ? /\//g : /\\/g, "_")
if (!dirNames.has(dirName)) {
dirNames.add(dirName)
dirs.push(`<Directory Id="${directoryId}" Name="${ROOT_DIR_ID}:\\${dirName}\\"/>`)
dirs.push(`<Directory Id="${directoryId}" Name="${ROOT_DIR_ID}:\\${dirName.replace(/\//g, "\\")}\\"/>`)
}
}
else if (!isRootDirAddedToRemoveTable) {
Expand Down
12 changes: 12 additions & 0 deletions test/out/windows/__snapshots__/msiTest.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,18 @@ Object {
}
`;

exports[`msi no asar 1`] = `
Object {
"win": Array [
Object {
"arch": "x64",
"file": "Test MSI-1.1.0.msi",
"safeArtifactName": "TestApp-1.1.0.msi",
},
],
}
`;

exports[`per-user 1`] = `
Object {
"win": Array [
Expand Down
14 changes: 14 additions & 0 deletions test/src/windows/msiTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,20 @@ test.ifAll.ifDevOrWinCi("msi", app({
// signed: true,
}))

test.ifAll.ifDevOrWinCi("msi no asar", app({
targets: Platform.WINDOWS.createTarget("msi"),
config: {
appId: "build.electron.test.msi.oneClick.perMachine",
extraMetadata: {
// version: "1.0.0",
},
productName: "Test MSI",
asar: false,
}
}, {
// signed: true,
}))

test.ifAll.ifDevOrWinCi("per-user", app({
targets: Platform.WINDOWS.createTarget("msi"),
config: {
Expand Down

0 comments on commit 7f75b45

Please sign in to comment.