mirror of
https://github.com/EasyTier/EasytierGame.git
synced 2025-05-19 10:27:56 +00:00
增加图标导出库
This commit is contained in:
+3
-1
@@ -11,4 +11,6 @@ dist
|
||||
.vscode
|
||||
release
|
||||
|
||||
src-tauri/easytier/logs
|
||||
src-tauri/easytier/logs
|
||||
src-tauri/easytier/tool/ResourcesExtract.exe
|
||||
src-tauri/easytier/tool/ResourcesExtract.cfg
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user