修复图标失效问题
This commit is contained in:
22
bin/builders/common.ts
vendored
22
bin/builders/common.ts
vendored
@@ -41,6 +41,28 @@ export async function mergeTauriConfig(
|
||||
tauriConf.package.productName = name;
|
||||
tauriConf.tauri.bundle.identifier = identifier;
|
||||
tauriConf.tauri.bundle.icon = [options.icon];
|
||||
if (process.platform === "win32") {
|
||||
const ico_path = path.join(npmDirectory, 'src-tauri/png/weread_32.ico');
|
||||
await fs.copyFile(options.icon, ico_path);
|
||||
|
||||
}
|
||||
let configPath = "";
|
||||
switch (process.platform) {
|
||||
case "win32": {
|
||||
configPath = path.join(npmDirectory, 'src-tauri/tauri.windows.conf.json');
|
||||
break;
|
||||
}
|
||||
case "darwin": {
|
||||
configPath = path.join(npmDirectory, 'src-tauri/tauri.macos.conf.json');
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
let bundleConf = {tauri: {bundle: tauriConf.tauri.bundle}};
|
||||
await fs.writeFile(
|
||||
configPath,
|
||||
Buffer.from(JSON.stringify(bundleConf), 'utf-8')
|
||||
);
|
||||
|
||||
|
||||
const configJsonPath = path.join(npmDirectory, 'src-tauri/tauri.conf.json')
|
||||
|
||||
Reference in New Issue
Block a user