Skip to content

Commit

Permalink
feat(portable): unpackDirName option for portable
Browse files Browse the repository at this point in the history
Close #3799
  • Loading branch information
develar committed Apr 5, 2019
1 parent 3be0181 commit 4ee4be6
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 2 deletions.
4 changes: 4 additions & 0 deletions packages/app-builder-lib/scheme.json
Original file line number Diff line number Diff line change
Expand Up @@ -3797,6 +3797,10 @@
"default": true,
"description": "If `warningsAsErrors` is `true` (default): NSIS will treat warnings as errors. If `warningsAsErrors` is `false`: NSIS will allow warnings.",
"type": "boolean"
},
"unpackDirName": {
"description": "The unpack directory name in [TEMP](https://www.askvg.com/where-does-windows-store-temporary-files-and-how-to-change-temp-folder-location/) directory.\n\nDefaults to [uuid](https://github.com/segmentio/ksuid) of build (changed on each build of portable executable).",
"type": "string"
}
},
"title": "PortableOptions",
Expand Down
5 changes: 3 additions & 2 deletions packages/app-builder-lib/src/targets/nsis/NsisTarget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,9 @@ export class NsisTarget extends Target {

this.configureDefinesForAllTypeOfInstaller(defines)
if (isPortable) {
defines.REQUEST_EXECUTION_LEVEL = (options as PortableOptions).requestExecutionLevel || "user"
defines.UNPACK_DIR_NAME = await executeAppBuilder(["ksuid"])
const portableOptions = options as PortableOptions
defines.REQUEST_EXECUTION_LEVEL = portableOptions.requestExecutionLevel || "user"
defines.UNPACK_DIR_NAME = portableOptions.unpackDirName || (await executeAppBuilder(["ksuid"]))
}
else {
await this.configureDefines(oneClick, defines)
Expand Down
7 changes: 7 additions & 0 deletions packages/app-builder-lib/src/targets/nsis/nsisOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,13 @@ export interface PortableOptions extends TargetSpecificOptions, CommonNsisOption
* @default user
*/
readonly requestExecutionLevel?: "user" | "highest" | "admin"

/**
* The unpack directory name in [TEMP](https://www.askvg.com/where-does-windows-store-temporary-files-and-how-to-change-temp-folder-location/) directory.
*
* Defaults to [uuid](https://github.com/segmentio/ksuid) of build (changed on each build of portable executable).
*/
readonly unpackDirName?: string
}

/**
Expand Down
1 change: 1 addition & 0 deletions test/src/windows/portableTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ test.ifAll.ifDevOrWinCi("portable zip", app({
publish: null,
portable: {
useZip: true,
unpackDirName: "0ujssxh0cECutqzMgbtXSGnjorm",
},
compression: "normal",
}
Expand Down

0 comments on commit 4ee4be6

Please sign in to comment.