Skip to content

Commit

Permalink
fix(app-builder-lib): change slash to backslash in NSIS's APP_PACKAGE…
Browse files Browse the repository at this point in the history
…_NAME (#6772)
  • Loading branch information
lowfront authored Apr 8, 2022
1 parent 354cb64 commit e861352
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/mighty-cameras-approve.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"app-builder-lib": patch
---

fix(app-builder-lib): change slash to backslash in NSIS's APP_PACKAGE_NAME
4 changes: 2 additions & 2 deletions packages/app-builder-lib/src/targets/nsis/NsisTarget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { execWine } from "../../wine"
import { WinPackager } from "../../winPackager"
import { archive, ArchiveOptions } from "../archive"
import { appendBlockmap, configureDifferentialAwareArchiveOptions, createBlockmap, createNsisWebDifferentialUpdateInfo } from "../differentialUpdateInfoBuilder"
import { getWindowsInstallationDirName } from "../targetUtil"
import { getWindowsInstallationAppPackageName, getWindowsInstallationDirName } from "../targetUtil"
import { addCustomMessageFileInclude, createAddLangsMacro, LangConfigurator } from "./nsisLang"
import { computeLicensePage } from "./nsisLicense"
import { NsisOptions, PortableOptions } from "./nsisOptions"
Expand Down Expand Up @@ -189,7 +189,7 @@ export class NsisTarget extends Target {
PROJECT_DIR: packager.projectDir,
BUILD_RESOURCES_DIR: packager.info.buildResourcesDir,

APP_PACKAGE_NAME: appInfo.name,
APP_PACKAGE_NAME: getWindowsInstallationAppPackageName(appInfo.name),
}
if (options.customNsisBinary?.debugLogging) {
defines.ENABLE_LOGGING_ELECTRON_BUILDER = null
Expand Down
5 changes: 5 additions & 0 deletions packages/app-builder-lib/src/targets/targetUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,8 @@ export async function createStageDirPath(target: Target, packager: PlatformPacka
export function getWindowsInstallationDirName(appInfo: AppInfo, isTryToUseProductName: boolean): string {
return isTryToUseProductName && /^[-_+0-9a-zA-Z .]+$/.test(appInfo.productFilename) ? appInfo.productFilename : appInfo.sanitizedName
}

// https://github.com/electron-userland/electron-builder/issues/6747
export function getWindowsInstallationAppPackageName(appName: string): string {
return appName.replace(/\//g, "\\")
}

0 comments on commit e861352

Please sign in to comment.