增加图标导出库

This commit is contained in:
heixiansen
2025-02-17 15:10:22 +08:00
parent e598f3806b
commit 7751c25e15
2 changed files with 37 additions and 1 deletions
+2
View File
@@ -12,3 +12,5 @@ dist
release
src-tauri/easytier/logs
src-tauri/easytier/tool/ResourcesExtract.exe
src-tauri/easytier/tool/ResourcesExtract.cfg
+34
View File
@@ -0,0 +1,34 @@
import { basename, extname } from "@tauri-apps/api/path";
import { exists } from "@tauri-apps/plugin-fs";
import { Command } from "@tauri-apps/plugin-shell";
export const getIcon = async function (sourcePath: string, icoDirPath: string) {
if(sourcePath.endsWith(".url")) return false;
let res = await Command.create("ResourcesExtract", [
"/Source",
sourcePath,
"/DestFolder",
icoDirPath,
"/ExtractIcons",
"1",
"/ExtractCursors",
"0",
"/OpenDestFolder",
"0",
"/MultiFilesMode",
"1"
]).execute();
if (res.code == 0) {
let icoPath = icoDirPath + "\\" + (await basename(sourcePath));
icoPath = icoPath.replace(`.${await extname(sourcePath)}`, "_1.ico");
console.log(icoPath)
if (await exists(icoPath)) {
return icoPath;
} else {
return false;
}
return;
} else {
return false;
}
};