Skip to content

Commit 05e0bc7

Browse files
authored
fix: check if custom nsis and/or nsis resources paths is not purely an whitespace string (#9420)
1 parent fa863f8 commit 05e0bc7

File tree

2 files changed

+14
-9
lines changed

2 files changed

+14
-9
lines changed

.changeset/tricky-tables-open.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"app-builder-lib": patch
3+
---
4+
5+
fix: check if custom nsis and/or nsis resources paths is not purely white space

packages/app-builder-lib/src/targets/nsis/nsisUtil.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Arch, copyFile, dirSize, log } from "builder-util"
1+
import { Arch, copyFile, dirSize, isEmptyOrSpaces, log } from "builder-util"
22
import { PackageFileInfo } from "builder-util-runtime"
33
import * as fs from "fs/promises"
44
import * as path from "path"
@@ -20,10 +20,10 @@ export const NsisTargetOptions = (() => {
2020
})()
2121

2222
export const NSIS_PATH = () => {
23-
const custom = process.env.ELECTRON_BUILDER_NSIS_DIR
24-
if (custom != null && custom.length > 0) {
25-
log.info({ path: custom.trim() }, "using local nsis")
26-
return Promise.resolve(custom.trim())
23+
const custom = process.env.ELECTRON_BUILDER_NSIS_DIR?.trim()
24+
if (!isEmptyOrSpaces(custom)) {
25+
log.info({ path: custom }, "using local nsis")
26+
return Promise.resolve(custom)
2727
}
2828
return NsisTargetOptions.then((options: NsisOptions) => {
2929
if (options.customNsisBinary) {
@@ -39,10 +39,10 @@ export const NSIS_PATH = () => {
3939
}
4040

4141
export const NSIS_RESOURCES_PATH = () => {
42-
const custom = process.env.ELECTRON_BUILDER_NSIS_RESOURCES_DIR
43-
if (custom != null && custom.length > 0) {
44-
log.info({ path: custom.trim() }, "using local nsis-resources")
45-
return Promise.resolve(custom.trim())
42+
const custom = process.env.ELECTRON_BUILDER_NSIS_RESOURCES_DIR?.trim()
43+
if (!isEmptyOrSpaces(custom)) {
44+
log.info({ path: custom }, "using local nsis-resources")
45+
return Promise.resolve(custom)
4646
}
4747
return NsisTargetOptions.then((options: NsisOptions) => {
4848
if (options.customNsisResources) {

0 commit comments

Comments
 (0)