Skip to content

Commit

Permalink
feat(portable): constant unpack path across all launches of the same …
Browse files Browse the repository at this point in the history
…executable

Close #3799
develar committed Apr 4, 2019
1 parent 2b1f0ad commit 3be0181
Showing 9 changed files with 28 additions and 21 deletions.
3 changes: 3 additions & 0 deletions .idea/dictionaries/develar.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -32,7 +32,7 @@
"dependencies": {
"7zip-bin": "~4.1.0",
"@types/is-ci": "^1.1.0",
"app-builder-bin": "2.6.5",
"app-builder-bin": "2.6.6",
"archiver": "^3.0.0",
"async-exit-hook": "^2.0.1",
"bluebird-lst": "^1.0.7",
2 changes: 1 addition & 1 deletion packages/app-builder-lib/package.json
Original file line number Diff line number Diff line change
@@ -42,7 +42,7 @@
"homepage": "https://github.com/electron-userland/electron-builder",
"dependencies": {
"7zip-bin": "~4.1.0",
"app-builder-bin": "2.6.5",
"app-builder-bin": "2.6.6",
"async-exit-hook": "^2.0.1",
"bluebird-lst": "^1.0.7",
"chromium-pickle-js": "^0.2.0",
1 change: 0 additions & 1 deletion packages/app-builder-lib/src/targets/AppImageTarget.ts
Original file line number Diff line number Diff line change
@@ -19,7 +19,6 @@ export default class AppImageTarget extends Target {
constructor(ignored: string, private readonly packager: LinuxPackager, private readonly helper: LinuxTargetHelper, readonly outDir: string) {
super("appImage")

// we add X-AppImage-BuildId to ensure that new desktop file will be installed
this.desktopEntry = new Lazy<string>(() => helper.computeDesktopEntry(this.options, "AppRun", {
"X-AppImage-Version": `${packager.appInfo.buildVersion}`,
}))
3 changes: 2 additions & 1 deletion packages/app-builder-lib/src/targets/nsis/NsisTarget.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { path7za } from "7zip-bin"
import BluebirdPromise from "bluebird-lst"
import { Arch, asArray, AsyncTaskManager, getPlatformIconFileName, InvalidConfigurationError, log, spawnAndWrite, use, exec } from "builder-util"
import { executeAppBuilder, Arch, asArray, AsyncTaskManager, getPlatformIconFileName, InvalidConfigurationError, log, spawnAndWrite, use, exec } from "builder-util"
import { PackageFileInfo, UUID, CURRENT_APP_PACKAGE_FILE_NAME, CURRENT_APP_INSTALLER_FILE_NAME } from "builder-util-runtime"
import { getBinFromGithub } from "../../binDownload"
import { statOrNull, walk } from "builder-util/out/fs"
@@ -228,6 +228,7 @@ 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"])
}
else {
await this.configureDefines(oneClick, defines)
5 changes: 3 additions & 2 deletions packages/app-builder-lib/templates/nsis/portable.nsi
Original file line number Diff line number Diff line change
@@ -12,7 +12,8 @@ Function .onInit
FunctionEnd

Section
StrCpy $INSTDIR $PLUGINSDIR\app
StrCpy $INSTDIR "$TEMP\${UNPACK_DIR_NAME}"
RMDir /r $INSTDIR
SetOutPath $INSTDIR

!ifdef APP_DIR_64
@@ -38,7 +39,7 @@ Section
System::Call 'Kernel32::SetEnvironmentVariable(t, t)i ("PORTABLE_EXECUTABLE_APP_FILENAME", "${APP_FILENAME}").r0'
${StdUtils.GetAllParameters} $R0 0
ExecWait "$INSTDIR\${APP_EXECUTABLE_FILENAME} $R0" $0
SetErrorlevel $0
SetErrorLevel $0

SetOutPath $PLUGINSDIR
RMDir /r $INSTDIR
23 changes: 13 additions & 10 deletions packages/builder-util-runtime/src/uuid.ts
Original file line number Diff line number Diff line change
@@ -119,16 +119,19 @@ export class UUID {

// according to rfc4122#section-4.1.1
function getVariant(bits: number) {
switch (bits) {
case 0: case 1: case 3:
return "ncs"
case 4: case 5:
return "rfc4122"
case 6:
return "microsoft"
default:
return "future"
}
switch (bits) {
case 0:
case 1:
case 3:
return "ncs"
case 4:
case 5:
return "rfc4122"
case 6:
return "microsoft"
default:
return "future"
}
}

enum UuidEncoding {
2 changes: 1 addition & 1 deletion packages/builder-util/package.json
Original file line number Diff line number Diff line change
@@ -11,7 +11,7 @@
"out"
],
"dependencies": {
"app-builder-bin": "2.6.5",
"app-builder-bin": "2.6.6",
"temp-file": "^3.3.2",
"fs-extra-p": "^7.0.1",
"is-ci": "^2.0.0",
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
@@ -1319,10 +1319,10 @@ anymatch@^2.0.0:
micromatch "^3.1.4"
normalize-path "^2.1.1"

[email protected].5:
version "2.6.5"
resolved "https://registry.yarnpkg.com/app-builder-bin/-/app-builder-bin-2.6.5.tgz#f763464aea3b4bed406e270d218cf7bc9d11c42e"
integrity sha512-6e0Zj0lTTZ1UpB8Tc1V0uUwuCiosdfyo+xMIwY5ASveyRU8Gy3Ge6wVmdalPtqySKcZc8AvXmEa7irFLcOCGMQ==
[email protected].6:
version "2.6.6"
resolved "https://registry.yarnpkg.com/app-builder-bin/-/app-builder-bin-2.6.6.tgz#904b0576a510047d03f63c8a02c38eef47871180"
integrity sha512-G0Ee6xkbxV+fvM/7xXWIgSDjWAD4E/d/aNbxerq/TVsCyBIau/0VPmrEqBMyZv0NbTwLDW5aF/yHG+0ZEY77kA==

append-transform@^1.0.0:
version "1.0.0"

0 comments on commit 3be0181

Please sign in to comment.