diff --git a/.gitignore b/.gitignore index 0533ab4..f101bc2 100644 --- a/.gitignore +++ b/.gitignore @@ -11,4 +11,6 @@ dist .vscode release -src-tauri/easytier/logs \ No newline at end of file +src-tauri/easytier/logs +src-tauri/easytier/tool/ResourcesExtract.exe +src-tauri/easytier/tool/ResourcesExtract.cfg diff --git a/composables/icon.ts b/composables/icon.ts new file mode 100644 index 0000000..8f6442a --- /dev/null +++ b/composables/icon.ts @@ -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; + } +};