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AAO,2BAA2B,CAAC,IAA5B,CAAiC,EAAE,IAAI,IAAI,CAAC,QAAL,CAAc,EAAd,CAAvC,CAAP;AACD;AACF,GAPiC,CAAlC;;AASA,MAAI,mBAAmB,CAAC,MAApB,KAA+B,CAAnC,EAAsC;AACpC,UAAM,KAAK,GAAG,KAAI,0CAAJ,GAAd;;AACA,SAAK,MAAM,IAAX,IAAmB,mBAAnB,EAAwC;AACtC,MAAA,KAAK,CAAC,IAAN,CAAW,aAAa,IAAI,CAAC,QAAL,CAAc,GAAd,EAAmB,IAAnB,EAAyB,OAAzB,CAAiC,KAAjC,EAAwC,IAAxC,CAA6C,EAArE,EAAyE,IAAzE;AACD;;AACD,IAAA,eAAe,CAAC,KAAhB,CAAsB,eAAe,oBAAK,IAAL,CAAU,EAA/C,EAAmD,KAAnD;AACD;AACF;;AAED,eAAe,qBAAf,CAAqC,IAArC,EAAiD;AAC/C,SAAO;AACL,IAAA,IAAI,EAAE,IADD;AAEL,IAAA,IAAI,EAAE,CAAC,MAAM,qBAAK,IAAL,CAAP,EAAmB,IAFpB;AAGL,IAAA,MAAM,EAAE,MAAM,sBAAS,IAAT;AAHT,GAAP;AAKD,C","sourcesContent":["import { path7za } from \"7zip-bin\"\nimport BluebirdPromise from \"bluebird-lst\"\nimport { executeAppBuilder, Arch, asArray, AsyncTaskManager, getPlatformIconFileName, InvalidConfigurationError, log, spawnAndWrite, use, exec } from \"builder-util\"\nimport { PackageFileInfo, UUID, CURRENT_APP_PACKAGE_FILE_NAME, CURRENT_APP_INSTALLER_FILE_NAME } from \"builder-util-runtime\"\nimport { getBinFromUrl } from \"../../binDownload\"\nimport { statOrNull, walk } from \"builder-util/out/fs\"\nimport { hashFile } from \"../../util/hash\"\nimport _debug from \"debug\"\nimport { readFile, stat, unlink } from \"fs-extra\"\nimport { Lazy } from \"lazy-val\"\nimport * as path from \"path\"\nimport { Target } from \"../../core\"\nimport { DesktopShortcutCreationPolicy, getEffectiveOptions } from \"../../options/CommonWindowsInstallerConfiguration\"\nimport { computeSafeArtifactNameIfNeeded, normalizeExt } from \"../../platformPackager\"\nimport { isMacOsCatalina } from \"../../util/macosVersion\"\nimport { time } from \"../../util/timer\"\nimport { execWine } from \"../../wine\"\nimport { WinPackager } from \"../../winPackager\"\nimport { archive, ArchiveOptions } from \"../archive\"\nimport { appendBlockmap, configureDifferentialAwareArchiveOptions, createBlockmap, createNsisWebDifferentialUpdateInfo } from \"../differentialUpdateInfoBuilder\"\nimport { getWindowsInstallationDirName } from \"../targetUtil\"\nimport { addCustomMessageFileInclude, createAddLangsMacro, LangConfigurator } from \"./nsisLang\"\nimport { computeLicensePage } from \"./nsisLicense\"\nimport { NsisOptions, PortableOptions } from \"./nsisOptions\"\nimport { NsisScriptGenerator } from \"./nsisScriptGenerator\"\nimport { AppPackageHelper, NSIS_PATH, nsisTemplatesDir } from \"./nsisUtil\"\n\nconst debug = _debug(\"electron-builder:nsis\")\n\n// noinspection SpellCheckingInspection\nconst ELECTRON_BUILDER_NS_UUID = UUID.parse(\"50e065bc-3134-11e6-9bab-38c9862bdaf3\")\n\n// noinspection SpellCheckingInspection\nconst nsisResourcePathPromise = new Lazy(() => getBinFromUrl(\"nsis-resources\", \"3.4.1\", \"Dqd6g+2buwwvoG1Vyf6BHR1b+25QMmPcwZx40atOT57gH27rkjOei1L0JTldxZu4NFoEmW4kJgZ3DlSWVON3+Q==\"))\n\nconst USE_NSIS_BUILT_IN_COMPRESSOR = false\n\nexport class NsisTarget extends Target {\n readonly options: NsisOptions\n\n /** @private */\n readonly archs: Map = new Map()\n\n constructor(readonly packager: WinPackager, readonly outDir: string, targetName: string, protected readonly packageHelper: AppPackageHelper) {\n super(targetName)\n\n this.packageHelper.refCount++\n\n this.options = targetName === \"portable\" ? Object.create(null) : {\n preCompressedFileExtensions: [\".avi\", \".mov\", \".m4v\", \".mp4\", \".m4p\", \".qt\", \".mkv\", \".webm\", \".vmdk\"],\n ...this.packager.config.nsis,\n }\n\n if (targetName !== \"nsis\") {\n Object.assign(this.options, (this.packager.config as any)[targetName === \"nsis-web\" ? \"nsisWeb\" : targetName])\n }\n\n const deps = packager.info.metadata.dependencies\n if (deps != null && deps[\"electron-squirrel-startup\"] != null) {\n log.warn('\"electron-squirrel-startup\" dependency is not required for NSIS')\n }\n }\n\n async build(appOutDir: string, arch: Arch) {\n this.archs.set(arch, appOutDir)\n }\n\n get isBuildDifferentialAware() {\n return !this.isPortable && this.options.differentialPackage !== false\n }\n\n private getPreCompressedFileExtensions(): Array | null {\n const result = this.isWebInstaller ? null : this.options.preCompressedFileExtensions\n return result == null ? null : asArray(result).map(it => it.startsWith(\".\") ? it : `.${it}`)\n }\n\n /** @private */\n async buildAppPackage(appOutDir: string, arch: Arch): Promise {\n const options = this.options\n const packager = this.packager\n\n const isBuildDifferentialAware = this.isBuildDifferentialAware\n const format = !isBuildDifferentialAware && options.useZip ? \"zip\" : \"7z\"\n const archiveFile = path.join(this.outDir, `${packager.appInfo.sanitizedName}-${packager.appInfo.version}-${Arch[arch]}.nsis.${format}`)\n const preCompressedFileExtensions = this.getPreCompressedFileExtensions()\n const archiveOptions: ArchiveOptions = {\n withoutDir: true,\n compression: packager.compression,\n excluded: preCompressedFileExtensions == null ? null : preCompressedFileExtensions.map(it => `*${it}`)\n }\n\n const timer = time(`nsis package, ${Arch[arch]}`)\n await archive(format, archiveFile, appOutDir, isBuildDifferentialAware ? configureDifferentialAwareArchiveOptions(archiveOptions) : archiveOptions)\n timer.end()\n\n if (isBuildDifferentialAware && this.isWebInstaller) {\n const data = await appendBlockmap(archiveFile)\n return {\n ...data,\n path: archiveFile,\n }\n }\n else {\n return await createPackageFileInfo(archiveFile)\n }\n }\n\n async finishBuild(): Promise {\n try {\n await this.buildInstaller()\n }\n finally {\n await this.packageHelper.finishBuild()\n }\n }\n\n protected get installerFilenamePattern(): string {\n // tslint:disable:no-invalid-template-strings\n return \"${productName} \" + (this.isPortable ? \"\" : \"Setup \") + \"${version}.${ext}\"\n }\n\n private get isPortable() {\n return this.name === \"portable\"\n }\n\n private async buildInstaller(): Promise {\n const packager = this.packager\n const appInfo = packager.appInfo\n const options = this.options\n const installerFilename = packager.expandArtifactNamePattern(options, \"exe\", null, this.installerFilenamePattern)\n const oneClick = options.oneClick !== false\n const installerPath = path.join(this.outDir, installerFilename)\n\n const logFields: any = {\n target: this.name,\n file: log.filePath(installerPath),\n archs: Array.from(this.archs.keys()).map(it => Arch[it]).join(\", \"),\n }\n const isPerMachine = options.perMachine === true\n if (!this.isPortable) {\n logFields.oneClick = oneClick\n logFields.perMachine = isPerMachine\n }\n\n await packager.info.callArtifactBuildStarted({\n targetPresentableName: this.name,\n file: installerPath,\n arch: null,\n }, logFields)\n\n const guid = options.guid || UUID.v5(appInfo.id, ELECTRON_BUILDER_NS_UUID)\n const uninstallAppKey = guid.replace(/\\\\/g, \" - \")\n const defines: any = {\n APP_ID: appInfo.id,\n APP_GUID: guid,\n // Windows bug - entry in Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall cannot have \\ symbols (dir)\n UNINSTALL_APP_KEY: uninstallAppKey,\n PRODUCT_NAME: appInfo.productName,\n PRODUCT_FILENAME: appInfo.productFilename,\n APP_FILENAME: getWindowsInstallationDirName(appInfo, !oneClick || isPerMachine),\n APP_DESCRIPTION: appInfo.description,\n VERSION: appInfo.version,\n\n PROJECT_DIR: packager.projectDir,\n BUILD_RESOURCES_DIR: packager.info.buildResourcesDir,\n\n APP_PACKAGE_NAME: appInfo.name\n }\n if (uninstallAppKey !== guid) {\n defines.UNINSTALL_REGISTRY_KEY_2 = `Software\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\Uninstall\\\\{${guid}}`\n }\n\n const commands: any = {\n OutFile: `\"${installerPath}\"`,\n VIProductVersion: appInfo.getVersionInWeirdWindowsForm(),\n VIAddVersionKey: this.computeVersionKey(),\n Unicode: this.isUnicodeEnabled,\n }\n\n const isPortable = this.isPortable\n const iconPath = (isPortable ? null : await packager.getResource(options.installerIcon, \"installerIcon.ico\")) || await packager.getIconPath()\n if (iconPath != null) {\n if (isPortable) {\n commands.Icon = `\"${iconPath}\"`\n }\n else {\n defines.MUI_ICON = iconPath\n defines.MUI_UNICON = iconPath\n }\n }\n\n const packageFiles: { [arch: string]: PackageFileInfo } = {}\n let estimatedSize = 0\n if (this.isPortable && options.useZip) {\n for (const [arch, dir] of this.archs.entries()) {\n defines[arch === Arch.x64 ? \"APP_DIR_64\" : \"APP_DIR_32\"] = dir\n }\n }\n else if (USE_NSIS_BUILT_IN_COMPRESSOR && this.archs.size === 1) {\n defines.APP_BUILD_DIR = this.archs.get(this.archs.keys().next().value)\n }\n else {\n await BluebirdPromise.map(this.archs.keys(), async arch => {\n const fileInfo = await this.packageHelper.packArch(arch, this)\n const file = fileInfo.path\n const defineKey = arch === Arch.x64 ? \"APP_64\" : \"APP_32\"\n defines[defineKey] = file\n defines[`${defineKey}_NAME`] = path.basename(file)\n // nsis expect a hexadecimal string\n defines[`${defineKey}_HASH`] = Buffer.from(fileInfo.sha512, \"base64\").toString(\"hex\").toUpperCase()\n\n if (this.isWebInstaller) {\n await packager.dispatchArtifactCreated(file, this, arch)\n packageFiles[Arch[arch]] = fileInfo\n }\n\n const archiveInfo = (await exec(path7za, [\"l\", file])).trim()\n // after adding blockmap data will be \"Warnings: 1\" in the end of output\n const match = archiveInfo.match(/(\\d+)\\s+\\d+\\s+\\d+\\s+files/)\n if (match == null) {\n log.warn({output: archiveInfo}, \"cannot compute size of app package\")\n }\n else {\n estimatedSize += parseInt(match[1], 10)\n }\n })\n }\n\n this.configureDefinesForAllTypeOfInstaller(defines)\n if (isPortable) {\n const portableOptions = options as PortableOptions\n defines.REQUEST_EXECUTION_LEVEL = portableOptions.requestExecutionLevel || \"user\"\n defines.UNPACK_DIR_NAME = portableOptions.unpackDirName || (await executeAppBuilder([\"ksuid\"]))\n }\n else {\n await this.configureDefines(oneClick, defines)\n }\n\n if (estimatedSize !== 0) {\n // in kb\n defines.ESTIMATED_SIZE = Math.round(estimatedSize / 1024)\n }\n\n if (packager.compression === \"store\") {\n commands.SetCompress = \"off\"\n }\n else {\n // difference - 33.540 vs 33.601, only 61 KB (but zip is faster to decompress)\n // do not use /SOLID - \"With solid compression, files are uncompressed to temporary file before they are copied to their final destination\",\n // it is not good for portable installer (where built-in NSIS compression is used). http://forums.winamp.com/showpost.php?p=2982902&postcount=6\n commands.SetCompressor = \"zlib\"\n if (!this.isWebInstaller) {\n defines.COMPRESS = \"auto\"\n }\n }\n\n debug(defines)\n debug(commands)\n\n if (packager.packagerOptions.effectiveOptionComputed != null && await packager.packagerOptions.effectiveOptionComputed([defines, commands])) {\n return\n }\n\n const sharedHeader = await this.computeCommonInstallerScriptHeader()\n const script = isPortable ? await readFile(path.join(nsisTemplatesDir, \"portable.nsi\"), \"utf8\") : await this.computeScriptAndSignUninstaller(defines, commands, installerPath, sharedHeader)\n await this.executeMakensis(defines, commands, sharedHeader + await this.computeFinalScript(script, true))\n await Promise.all([packager.sign(installerPath), defines.UNINSTALLER_OUT_FILE == null ? Promise.resolve() : unlink(defines.UNINSTALLER_OUT_FILE)])\n\n const safeArtifactName = computeSafeArtifactNameIfNeeded(installerFilename, () => this.generateGitHubInstallerName())\n let updateInfo: any\n if (this.isWebInstaller) {\n updateInfo = createNsisWebDifferentialUpdateInfo(installerPath, packageFiles)\n }\n else if (this.isBuildDifferentialAware) {\n updateInfo = await createBlockmap(installerPath, this, packager, safeArtifactName)\n }\n\n if (updateInfo != null && isPerMachine && oneClick) {\n updateInfo.isAdminRightsRequired = true\n }\n\n await packager.info.callArtifactBuildCompleted({\n file: installerPath,\n updateInfo,\n target: this,\n packager,\n arch: this.archs.size === 1 ? this.archs.keys().next().value : null,\n safeArtifactName,\n isWriteUpdateInfo: !this.isPortable,\n })\n }\n\n protected generateGitHubInstallerName() {\n const appInfo = this.packager.appInfo\n const classifier = appInfo.name.toLowerCase() === appInfo.name ? \"setup-\" : \"Setup-\"\n return `${appInfo.name}-${this.isPortable ? \"\" : classifier}${appInfo.version}.exe`\n }\n\n private get isUnicodeEnabled() {\n return this.options.unicode !== false\n }\n\n get isWebInstaller(): boolean {\n return false\n }\n\n private async computeScriptAndSignUninstaller(defines: any, commands: any, installerPath: string, sharedHeader: string) {\n const packager = this.packager\n const customScriptPath = await packager.getResource(this.options.script, \"installer.nsi\")\n const script = await readFile(customScriptPath || path.join(nsisTemplatesDir, \"installer.nsi\"), \"utf8\")\n\n if (customScriptPath != null) {\n log.info({reason: \"custom NSIS script is used\"}, \"uninstaller is not signed by electron-builder\")\n return script\n }\n\n // https://github.com/electron-userland/electron-builder/issues/2103\n // it is more safe and reliable to write uninstaller to our out dir\n const uninstallerPath = path.join(this.outDir, `.__uninstaller-${this.name}-${this.packager.appInfo.sanitizedName}.exe`)\n const isWin = process.platform === \"win32\"\n defines.BUILD_UNINSTALLER = null\n defines.UNINSTALLER_OUT_FILE = isWin ? uninstallerPath : path.win32.join(\"Z:\", uninstallerPath)\n await this.executeMakensis(defines, commands, sharedHeader + await this.computeFinalScript(script, false))\n\n // http://forums.winamp.com/showthread.php?p=3078545\n //\n if (await isMacOsCatalina()) {\n (await packager.vm.value).exec(installerPath, [])\n }\n else {\n await execWine(installerPath)\n }\n await packager.sign(uninstallerPath, \" Signing NSIS uninstaller\")\n\n delete defines.BUILD_UNINSTALLER\n // platform-specific path, not wine\n defines.UNINSTALLER_OUT_FILE = uninstallerPath\n return script\n }\n\n private computeVersionKey() {\n // Error: invalid VIProductVersion format, should be X.X.X.X\n // so, we must strip beta\n const localeId = this.options.language || \"1033\"\n const appInfo = this.packager.appInfo\n const versionKey = [\n `/LANG=${localeId} ProductName \"${appInfo.productName}\"`,\n `/LANG=${localeId} ProductVersion \"${appInfo.version}\"`,\n `/LANG=${localeId} LegalCopyright \"${appInfo.copyright}\"`,\n `/LANG=${localeId} FileDescription \"${appInfo.description}\"`,\n `/LANG=${localeId} FileVersion \"${appInfo.buildVersion}\"`,\n ]\n use(this.packager.platformSpecificBuildOptions.legalTrademarks, it => versionKey.push(`/LANG=${localeId} LegalTrademarks \"${it}\"`))\n use(appInfo.companyName, it => versionKey.push(`/LANG=${localeId} CompanyName \"${it}\"`))\n return versionKey\n }\n\n protected configureDefines(oneClick: boolean, defines: any): Promise {\n const packager = this.packager\n const options = this.options\n\n const asyncTaskManager = new AsyncTaskManager(packager.info.cancellationToken)\n\n if (oneClick) {\n defines.ONE_CLICK = null\n\n if (options.runAfterFinish !== false) {\n defines.RUN_AFTER_FINISH = null\n }\n\n asyncTaskManager.add(async () => {\n const installerHeaderIcon = await packager.getResource(options.installerHeaderIcon, \"installerHeaderIcon.ico\")\n if (installerHeaderIcon != null) {\n defines.HEADER_ICO = installerHeaderIcon\n }\n })\n }\n else {\n if (options.runAfterFinish === false) {\n defines.HIDE_RUN_AFTER_FINISH = null\n }\n\n asyncTaskManager.add(async () => {\n const installerHeader = await packager.getResource(options.installerHeader, \"installerHeader.bmp\")\n if (installerHeader != null) {\n defines.MUI_HEADERIMAGE = null\n defines.MUI_HEADERIMAGE_RIGHT = null\n defines.MUI_HEADERIMAGE_BITMAP = installerHeader\n }\n })\n\n asyncTaskManager.add(async () => {\n const bitmap = (await packager.getResource(options.installerSidebar, \"installerSidebar.bmp\")) || \"${NSISDIR}\\\\Contrib\\\\Graphics\\\\Wizard\\\\nsis3-metro.bmp\"\n defines.MUI_WELCOMEFINISHPAGE_BITMAP = bitmap\n defines.MUI_UNWELCOMEFINISHPAGE_BITMAP = (await packager.getResource(options.uninstallerSidebar, \"uninstallerSidebar.bmp\")) || bitmap\n })\n\n if (options.allowElevation !== false) {\n defines.MULTIUSER_INSTALLMODE_ALLOW_ELEVATION = null\n }\n }\n\n if (options.perMachine === true) {\n defines.INSTALL_MODE_PER_ALL_USERS = null\n }\n\n if (!oneClick || options.perMachine === true) {\n defines.INSTALL_MODE_PER_ALL_USERS_REQUIRED = null\n }\n\n if (options.allowToChangeInstallationDirectory) {\n if (oneClick) {\n throw new InvalidConfigurationError(\"allowToChangeInstallationDirectory makes sense only for assisted installer (please set oneClick to false)\")\n }\n defines.allowToChangeInstallationDirectory = null\n }\n\n const commonOptions = getEffectiveOptions(options, packager)\n\n if (commonOptions.menuCategory != null) {\n defines.MENU_FILENAME = commonOptions.menuCategory\n }\n\n defines.SHORTCUT_NAME = commonOptions.shortcutName\n\n if (options.deleteAppDataOnUninstall) {\n defines.DELETE_APP_DATA_ON_UNINSTALL = null\n }\n\n asyncTaskManager.add(async () => {\n const uninstallerIcon = await packager.getResource(options.uninstallerIcon, \"uninstallerIcon.ico\")\n if (uninstallerIcon != null) {\n // we don't need to copy MUI_UNICON (defaults to app icon), so, we have 2 defines\n defines.UNINSTALLER_ICON = uninstallerIcon\n defines.MUI_UNICON = uninstallerIcon\n }\n })\n\n defines.UNINSTALL_DISPLAY_NAME = packager.expandMacro(options.uninstallDisplayName || \"${productName} ${version}\", null, {}, false)\n if (commonOptions.isCreateDesktopShortcut === DesktopShortcutCreationPolicy.NEVER) {\n defines.DO_NOT_CREATE_DESKTOP_SHORTCUT = null\n }\n if (commonOptions.isCreateDesktopShortcut === DesktopShortcutCreationPolicy.ALWAYS) {\n defines.RECREATE_DESKTOP_SHORTCUT = null\n }\n if (!commonOptions.isCreateStartMenuShortcut) {\n defines.DO_NOT_CREATE_START_MENU_SHORTCUT = null\n }\n\n if (options.displayLanguageSelector === true) {\n defines.DISPLAY_LANG_SELECTOR = null\n }\n\n return asyncTaskManager.awaitTasks()\n }\n\n private configureDefinesForAllTypeOfInstaller(defines: any) {\n const appInfo = this.packager.appInfo\n const companyName = appInfo.companyName\n if (companyName != null) {\n defines.COMPANY_NAME = companyName\n }\n\n // electron uses product file name as app data, define it as well to remove on uninstall\n if (defines.APP_FILENAME !== appInfo.productFilename) {\n defines.APP_PRODUCT_FILENAME = appInfo.productFilename\n }\n\n if (this.isWebInstaller) {\n defines.APP_PACKAGE_STORE_FILE = `${appInfo.updaterCacheDirName}\\\\${CURRENT_APP_PACKAGE_FILE_NAME}`\n }\n else {\n defines.APP_INSTALLER_STORE_FILE = `${appInfo.updaterCacheDirName}\\\\${CURRENT_APP_INSTALLER_FILE_NAME}`\n }\n\n if (!this.isWebInstaller && defines.APP_BUILD_DIR == null) {\n const options = this.options\n if (options.useZip) {\n defines.ZIP_COMPRESSION = null\n }\n\n defines.COMPRESSION_METHOD = options.useZip ? \"zip\" : \"7z\"\n }\n }\n\n private async executeMakensis(defines: any, commands: any, script: string) {\n const args: Array = (this.options.warningsAsErrors === false) ? [] : [\"-WX\"]\n for (const name of Object.keys(defines)) {\n const value = defines[name]\n if (value == null) {\n args.push(`-D${name}`)\n }\n else {\n args.push(`-D${name}=${value}`)\n }\n }\n\n for (const name of Object.keys(commands)) {\n const value = commands[name]\n if (Array.isArray(value)) {\n for (const c of value) {\n args.push(`-X${name} ${c}`)\n }\n }\n else {\n args.push(`-X${name} ${value}`)\n }\n }\n\n args.push(\"-\")\n\n if (this.packager.debugLogger.isEnabled) {\n this.packager.debugLogger.add(\"nsis.script\", script)\n }\n\n const nsisPath = await NSIS_PATH.value\n const command = path.join(nsisPath, process.platform === \"darwin\" ? \"mac\" : (process.platform === \"win32\" ? \"Bin\" : \"linux\"), process.platform === \"win32\" ? \"makensis.exe\" : \"makensis\")\n await spawnAndWrite(command, args, script, {\n // we use NSIS_CONFIG_CONST_DATA_PATH=no to build makensis on Linux, but in any case it doesn't use stubs as MacOS/Windows version, so, we explicitly set NSISDIR\n env: {...process.env, NSISDIR: nsisPath},\n cwd: nsisTemplatesDir,\n })\n }\n\n private async computeCommonInstallerScriptHeader() {\n const packager = this.packager\n const options = this.options\n const scriptGenerator = new NsisScriptGenerator()\n const langConfigurator = new LangConfigurator(options)\n\n scriptGenerator.include(path.join(nsisTemplatesDir, \"include\", \"StdUtils.nsh\"))\n\n const includeDir = path.join(nsisTemplatesDir, \"include\")\n scriptGenerator.addIncludeDir(includeDir)\n scriptGenerator.flags([\"updated\", \"force-run\", \"keep-shortcuts\", \"no-desktop-shortcut\", \"delete-app-data\", \"allusers\", \"currentuser\"])\n\n createAddLangsMacro(scriptGenerator, langConfigurator)\n\n const taskManager = new AsyncTaskManager(packager.info.cancellationToken)\n\n const pluginArch = this.isUnicodeEnabled ? \"x86-unicode\" : \"x86-ansi\"\n taskManager.add(async () => {\n scriptGenerator.addPluginDir(pluginArch, path.join(await nsisResourcePathPromise.value, \"plugins\", pluginArch))\n })\n\n taskManager.add(async () => {\n const userPluginDir = path.join(packager.info.buildResourcesDir, pluginArch)\n const stat = await statOrNull(userPluginDir)\n if (stat != null && stat.isDirectory()) {\n scriptGenerator.addPluginDir(pluginArch, userPluginDir)\n }\n })\n\n taskManager.addTask(addCustomMessageFileInclude(\"messages.yml\", packager, scriptGenerator, langConfigurator))\n\n if (!this.isPortable) {\n if (options.oneClick === false) {\n taskManager.addTask(addCustomMessageFileInclude(\"assistedMessages.yml\", packager, scriptGenerator, langConfigurator))\n }\n\n taskManager.add(async () => {\n const customInclude = await packager.getResource(this.options.include, \"installer.nsh\")\n if (customInclude != null) {\n scriptGenerator.addIncludeDir(packager.info.buildResourcesDir)\n scriptGenerator.include(customInclude)\n }\n })\n }\n\n await taskManager.awaitTasks()\n return scriptGenerator.build()\n }\n\n private async computeFinalScript(originalScript: string, isInstaller: boolean) {\n const packager = this.packager\n const options = this.options\n const langConfigurator = new LangConfigurator(options)\n\n const scriptGenerator = new NsisScriptGenerator()\n const taskManager = new AsyncTaskManager(packager.info.cancellationToken)\n\n if (isInstaller) {\n // http://stackoverflow.com/questions/997456/nsis-license-file-based-on-language-selection\n taskManager.add(() => computeLicensePage(packager, options, scriptGenerator, langConfigurator.langs))\n }\n\n await taskManager.awaitTasks()\n\n if (this.isPortable) {\n return scriptGenerator.build() + originalScript\n }\n\n const preCompressedFileExtensions = this.getPreCompressedFileExtensions()\n if (preCompressedFileExtensions != null && preCompressedFileExtensions.length !== 0) {\n for (const [arch, dir] of this.archs.entries()) {\n await generateForPreCompressed(preCompressedFileExtensions, dir, arch, scriptGenerator)\n }\n }\n\n const fileAssociations = packager.fileAssociations\n if (fileAssociations.length !== 0) {\n\n scriptGenerator.include(path.join(path.join(nsisTemplatesDir, \"include\"), \"FileAssociation.nsh\"))\n if (isInstaller) {\n const registerFileAssociationsScript = new NsisScriptGenerator()\n for (const item of fileAssociations) {\n const extensions = asArray(item.ext).map(normalizeExt)\n for (const ext of extensions) {\n const customIcon = await packager.getResource(getPlatformIconFileName(item.icon, false), `${extensions[0]}.ico`)\n let installedIconPath = \"$appExe,0\"\n if (customIcon != null) {\n installedIconPath = `$INSTDIR\\\\resources\\\\${path.basename(customIcon)}`\n registerFileAssociationsScript.file(installedIconPath, customIcon)\n }\n\n const icon = `\"${installedIconPath}\"`\n const commandText = `\"Open with ${packager.appInfo.productName}\"`\n const command = '\"$appExe $\\\\\"%1$\\\\\"\"'\n registerFileAssociationsScript.insertMacro(\"APP_ASSOCIATE\", `\"${ext}\" \"${item.name || ext}\" \"${item.description || \"\"}\" ${icon} ${commandText} ${command}`)\n }\n }\n scriptGenerator.macro(\"registerFileAssociations\", registerFileAssociationsScript)\n }\n else {\n const unregisterFileAssociationsScript = new NsisScriptGenerator()\n for (const item of fileAssociations) {\n for (const ext of asArray(item.ext)) {\n unregisterFileAssociationsScript.insertMacro(\"APP_UNASSOCIATE\", `\"${normalizeExt(ext)}\" \"${item.name || ext}\"`)\n }\n }\n scriptGenerator.macro(\"unregisterFileAssociations\", unregisterFileAssociationsScript)\n }\n }\n\n return scriptGenerator.build() + originalScript\n }\n}\n\nasync function generateForPreCompressed(preCompressedFileExtensions: Array, dir: string, arch: Arch, scriptGenerator: NsisScriptGenerator) {\n const resourcesDir = path.join(dir, \"resources\")\n const dirInfo = await statOrNull(resourcesDir)\n if (dirInfo == null || !dirInfo.isDirectory()) {\n return\n }\n\n const nodeModules = `${path.sep}node_modules`\n const preCompressedAssets = await walk(resourcesDir, (file, stat) => {\n if (stat.isDirectory()) {\n return !file.endsWith(nodeModules)\n }\n else {\n return preCompressedFileExtensions.some(it => file.endsWith(it))\n }\n })\n\n if (preCompressedAssets.length !== 0) {\n const macro = new NsisScriptGenerator()\n for (const file of preCompressedAssets) {\n macro.file(`$INSTDIR\\\\${path.relative(dir, file).replace(/\\//g, \"\\\\\")}`, file)\n }\n scriptGenerator.macro(`customFiles_${Arch[arch]}`, macro)\n }\n}\n\nasync function createPackageFileInfo(file: string): Promise {\n return {\n path: file,\n size: (await stat(file)).size,\n sha512: await hashFile(file),\n }\n}"],"sourceRoot":""}