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gBAChC,OAAO,EAAE,IAAI,CAAC,QAAQ,CAAC,OAAO;gBAC9B,KAAK,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI;gBACzB,OAAO,EAAE,IAAI,CAAC,QAAQ,CAAC,WAAW;gBAClC,UAAU,EAAE,IAAI,CAAC,QAAQ,CAAC,MAAM;gBAChC,IAAI,EAAE,IAAI,KAAK,MAAM,GAAG,EAAE,GAAG,EAAE;gBAC/B,MAAM,EAAE,KAAK;gBACb,UAAU,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI;gBAC9B,OAAO,EAAE;aACF,IAAI,CAAC,QAAQ,CAAC,IAAI;gBACf,IAAI,CAAC,QAAQ,CAAC,WAAW;aAC5B,IAAI,CAAC,QAAQ,CAAC,IAAI;;;aAGlB,IAAI,CAAC,QAAQ,CAAC,IAAI;OACxB;gBACD,IAAI,EAAE,MAAM,IAAI,CAAC,YAAY;aAC9B,CAAA;YAED,EAAE,CAAC,CAAC,IAAI,CAAC,iBAAiB,IAAI,IAAI,CAAC,CAAC,CAAC;gBACnC,MAAM,CAAC,MAAM,CAAC,aAAa,EAAE,IAAI,CAAC,iBAAiB,CAAC,CAAA;YACtD,CAAC;YACD,MAAM,CAAC,MAAM,QAAQ,CAAC;gBACpB,GAAG,EAAE,sBAAqC,CAAC;gBAC3C,OAAO,EAAE,MAAM;gBACf,GAAG,EAAE,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC;gBACzB,MAAM,EAAE;oBACN,KAAK,EAAE,aAAa;iBACrB;aACF,CAAC;iBACC,IAAI,CAAC,EAAE,IAAI,IAAI,CAAC,uBAAuB,CAAC,EAAE,CAAC,CAAC,CAAA;QACjD,CAAC;KAAA;AACH,CAAC;AAnFD;+BAmFC,CAAA","sourcesContent":["import * as path from \"path\"\nimport { Promise as BluebirdPromise } from \"bluebird\"\nimport { tsAwaiter } from \"./awaiter\"\nimport { init } from \"../lib/linux\"\nimport { PlatformPackager, BuildInfo } from \"./platformPackager\"\nimport { dir as _tpmDir, Options as TmpOptions } from \"tmp\"\nimport { exec, log } from \"./util\"\nimport { State as Gm } from \"gm\"\n\nconst __awaiter = tsAwaiter\nArray.isArray(__awaiter)\n\nconst buildDeb = BluebirdPromise.promisify(init().build)\nconst tmpDir = BluebirdPromise.promisify(<(config: TmpOptions, callback: (error: Error, path: string, cleanupCallback: () => void) => void) => void>_tpmDir)\n\nexport default class LinuxPackager extends PlatformPackager<DebOptions> {\n desktopIcons: Promise<Array<string>>\n\n constructor(info: BuildInfo) {\n super(info)\n\n if (this.options.dist && (this.customDistOptions == null || this.customDistOptions.desktopTemplate == null)) {\n this.desktopIcons = this.computeDesktopIconPath()\n }\n else {\n this.desktopIcons = BluebirdPromise.resolve(null)\n }\n }\n\n private async computeDesktopIconPath(): Promise<Array<string>> {\n const tempDir = await tmpDir({\n unsafeCleanup: true,\n prefix: \"png-icons\"\n })\n\n const outputs = await exec(\"icns2png\", [\"-x\", \"-o\", tempDir, path.join(this.projectDir, \"build\", \"icon.icns\")])\n if (!outputs[0].toString().includes(\"ih32\")) {\n log(\"48x48 is not found in the icns, 128x128 will be resized\")\n // icns doesn't contain required 48x48, use gm to resize\n await new BluebirdPromise((resolve, reject) => {\n (<Gm>require(\"gm\")(path.join(tempDir, \"icon_128x128x32.png\")))\n .resize(48, 48)\n .write(path.join(tempDir, \"icon_48x48x32.png\"), error => error == null ? resolve() : reject(error))\n })\n }\n\n const appName = this.metadata.name\n function createMapping(size: string) {\n return `${tempDir}/icon_${size}x${size}x32.png=/usr/share/icons/hicolor/${size}x${size}/apps/${appName}.png`\n }\n\n return [\n createMapping(\"16\"),\n createMapping(\"32\"),\n createMapping(\"48\"),\n createMapping(\"128\"),\n createMapping(\"256\"),\n createMapping(\"512\"),\n ]\n }\n\n getBuildConfigurationKey() {\n return \"linux\"\n }\n\n async packageInDistributableFormat(outDir: string, arch: string): Promise<any> {\n const specification: DebOptions = {\n version: this.metadata.version,\n title: this.metadata.name,\n comment: this.metadata.description,\n maintainer: this.metadata.author,\n arch: arch === \"ia32\" ? 32 : 64,\n target: \"deb\",\n executable: this.metadata.name,\n desktop: `[Desktop Entry]\n Name=${this.metadata.name}\n Comment=${this.metadata.description}\n Exec=${this.metadata.name}\n Terminal=false\n Type=Application\n Icon=${this.metadata.name}\n `,\n dirs: await this.desktopIcons\n }\n\n if (this.customDistOptions != null) {\n Object.assign(specification, this.customDistOptions)\n }\n return await buildDeb({\n log: function emptyLog() {/* ignore out */},\n appPath: outDir,\n out: path.dirname(outDir),\n config: {\n linux: specification\n }\n })\n .then(it => this.dispatchArtifactCreated(it))\n }\n}\n\ninterface DebOptions {\n title: string\n comment: string\n\n version: string\n\n arch: number\n maintainer: string\n executable: string\n target: string\n\n desktopTemplate?: string\n desktop?: string\n\n dirs?: Array<string>\n}"]}
\No newline at end of file