From a525b264774a8a46d11065d7bc291d740809730e Mon Sep 17 00:00:00 2001 From: Tlntin Date: Sun, 11 Dec 2022 05:35:45 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dpake-cli=E5=BD=93=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E8=BE=93=E5=85=A5=E5=9B=BE=E6=A0=87=E6=A0=BC=E5=BC=8F?= =?UTF-8?q?=E9=94=99=E8=AF=AF=E5=BC=95=E8=B5=B7=E6=97=A0=E6=B3=95=E5=AE=89?= =?UTF-8?q?=E8=A3=85=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/builders/LinuxBuilder.ts | 15 --------------- bin/builders/common.ts | 15 +++------------ dist/cli.js | 35 +++++------------------------------ 3 files changed, 8 insertions(+), 57 deletions(-) diff --git a/bin/builders/LinuxBuilder.ts b/bin/builders/LinuxBuilder.ts index ed55ab9..cec50b1 100644 --- a/bin/builders/LinuxBuilder.ts +++ b/bin/builders/LinuxBuilder.ts @@ -46,21 +46,6 @@ export default class LinuxBuilder implements IBuilder { const { name } = options; await mergeTauriConfig(url, options, tauriConf); - // write desktop - const assertSrc = `src-tauri/assets/${name}.desktop`; - const assertPath = path.join(npmDirectory, assertSrc); - const desktopStr = ` -[Desktop Entry] -Encoding=UTF-8 -Categories=Office -Exec=${name} -Icon=${name} -Name=${name} -StartupNotify=true -Terminal=false -Type=Application - ` - await fs.writeFile(assertPath, desktopStr); const _ = await shellExec(`cd ${npmDirectory} && npm install && npm run build`); let arch = ""; if (process.arch === "x64") { diff --git a/bin/builders/common.ts b/bin/builders/common.ts index b3fab61..b081e35 100644 --- a/bin/builders/common.ts +++ b/bin/builders/common.ts @@ -58,25 +58,16 @@ export async function mergeTauriConfig( } } if (process.platform === "linux") { - tauriConf.package.productName = name.toLowerCase(); - if (customIconExt === ".png") { - const installSrc = `/usr/share/applications/${name.toLowerCase()}.desktop`; - const assertSrc = `src-tauri/assets/${name.toLowerCase()}.desktop`; - const assertPath = path.join(npmDirectory, assertSrc); - tauriConf.tauri.bundle.deb.files = { - [installSrc]: assertPath - } - } else { + delete tauriConf.tauri.bundle.deb.files; + if (customIconExt != ".png") { updateIconPath = false; logger.warn(`icon file in Linux must be 512 * 512 pix with .png type, but you give ${customIconExt}`); } } - if (process.platform === "darwin") { - if (customIconExt !== ".icns") { + if (process.platform === "darwin" && customIconExt !== ".icns") { updateIconPath = false; logger.warn(`icon file in MacOS must be .icns type, but you give ${customIconExt}`); - } } if (updateIconPath) { tauriConf.tauri.bundle.icon = [options.icon]; diff --git a/dist/cli.js b/dist/cli.js index 3197890..dfed20e 100644 --- a/dist/cli.js +++ b/dist/cli.js @@ -1653,25 +1653,15 @@ function mergeTauriConfig(url, options, tauriConf) { } } if (process.platform === "linux") { - tauriConf.package.productName = name.toLowerCase(); - if (customIconExt === ".png") { - const installSrc = `/usr/share/applications/${name.toLowerCase()}.desktop`; - const assertSrc = `src-tauri/assets/${name.toLowerCase()}.desktop`; - const assertPath = path.join(npmDirectory, assertSrc); - tauriConf.tauri.bundle.deb.files = { - [installSrc]: assertPath - }; - } - else { + delete tauriConf.tauri.bundle.deb.files; + if (customIconExt != ".png") { updateIconPath = false; logger.warn(`icon file in Linux must be 512 * 512 pix with .png type, but you give ${customIconExt}`); } } - if (process.platform === "darwin") { - if (customIconExt !== ".icns") { - updateIconPath = false; - logger.warn(`icon file in MacOS must be .icns type, but you give ${customIconExt}`); - } + if (process.platform === "darwin" && customIconExt !== ".icns") { + updateIconPath = false; + logger.warn(`icon file in MacOS must be .icns type, but you give ${customIconExt}`); } if (updateIconPath) { tauriConf.tauri.bundle.icon = [options.icon]; @@ -2133,21 +2123,6 @@ class LinuxBuilder { logger.debug('PakeAppOptions', options); const { name } = options; yield mergeTauriConfig(url, options, tauriConf); - // write desktop - const assertSrc = `src-tauri/assets/${name}.desktop`; - const assertPath = path.join(npmDirectory, assertSrc); - const desktopStr = ` -[Desktop Entry] -Encoding=UTF-8 -Categories=Office -Exec=${name} -Icon=${name} -Name=${name} -StartupNotify=true -Terminal=false -Type=Application - `; - yield fs.writeFile(assertPath, desktopStr); yield shellExec(`cd ${npmDirectory} && npm install && npm run build`); let arch = ""; if (process.arch === "x64") {