修复pake-cli当用户输入图标格式错误引起无法安装问题
This commit is contained in:
15
bin/builders/LinuxBuilder.ts
vendored
15
bin/builders/LinuxBuilder.ts
vendored
@@ -46,21 +46,6 @@ export default class LinuxBuilder implements IBuilder {
|
|||||||
const { name } = options;
|
const { name } = options;
|
||||||
|
|
||||||
await mergeTauriConfig(url, options, tauriConf);
|
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`);
|
const _ = await shellExec(`cd ${npmDirectory} && npm install && npm run build`);
|
||||||
let arch = "";
|
let arch = "";
|
||||||
if (process.arch === "x64") {
|
if (process.arch === "x64") {
|
||||||
|
|||||||
15
bin/builders/common.ts
vendored
15
bin/builders/common.ts
vendored
@@ -58,25 +58,16 @@ export async function mergeTauriConfig(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (process.platform === "linux") {
|
if (process.platform === "linux") {
|
||||||
tauriConf.package.productName = name.toLowerCase();
|
delete tauriConf.tauri.bundle.deb.files;
|
||||||
if (customIconExt === ".png") {
|
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 {
|
|
||||||
updateIconPath = false;
|
updateIconPath = false;
|
||||||
logger.warn(`icon file in Linux must be 512 * 512 pix with .png type, but you give ${customIconExt}`);
|
logger.warn(`icon file in Linux must be 512 * 512 pix with .png type, but you give ${customIconExt}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (process.platform === "darwin") {
|
if (process.platform === "darwin" && customIconExt !== ".icns") {
|
||||||
if (customIconExt !== ".icns") {
|
|
||||||
updateIconPath = false;
|
updateIconPath = false;
|
||||||
logger.warn(`icon file in MacOS must be .icns type, but you give ${customIconExt}`);
|
logger.warn(`icon file in MacOS must be .icns type, but you give ${customIconExt}`);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (updateIconPath) {
|
if (updateIconPath) {
|
||||||
tauriConf.tauri.bundle.icon = [options.icon];
|
tauriConf.tauri.bundle.icon = [options.icon];
|
||||||
|
|||||||
35
dist/cli.js
vendored
35
dist/cli.js
vendored
@@ -1653,25 +1653,15 @@ function mergeTauriConfig(url, options, tauriConf) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (process.platform === "linux") {
|
if (process.platform === "linux") {
|
||||||
tauriConf.package.productName = name.toLowerCase();
|
delete tauriConf.tauri.bundle.deb.files;
|
||||||
if (customIconExt === ".png") {
|
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 {
|
|
||||||
updateIconPath = false;
|
updateIconPath = false;
|
||||||
logger.warn(`icon file in Linux must be 512 * 512 pix with .png type, but you give ${customIconExt}`);
|
logger.warn(`icon file in Linux must be 512 * 512 pix with .png type, but you give ${customIconExt}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (process.platform === "darwin") {
|
if (process.platform === "darwin" && customIconExt !== ".icns") {
|
||||||
if (customIconExt !== ".icns") {
|
updateIconPath = false;
|
||||||
updateIconPath = false;
|
logger.warn(`icon file in MacOS must be .icns type, but you give ${customIconExt}`);
|
||||||
logger.warn(`icon file in MacOS must be .icns type, but you give ${customIconExt}`);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (updateIconPath) {
|
if (updateIconPath) {
|
||||||
tauriConf.tauri.bundle.icon = [options.icon];
|
tauriConf.tauri.bundle.icon = [options.icon];
|
||||||
@@ -2133,21 +2123,6 @@ class LinuxBuilder {
|
|||||||
logger.debug('PakeAppOptions', options);
|
logger.debug('PakeAppOptions', options);
|
||||||
const { name } = options;
|
const { name } = options;
|
||||||
yield mergeTauriConfig(url, options, tauriConf);
|
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`);
|
yield shellExec(`cd ${npmDirectory} && npm install && npm run build`);
|
||||||
let arch = "";
|
let arch = "";
|
||||||
if (process.arch === "x64") {
|
if (process.arch === "x64") {
|
||||||
|
|||||||
Reference in New Issue
Block a user