diff --git a/src-tauri/capabilities/TeyvatGuide.json b/src-tauri/capabilities/TeyvatGuide.json index 72a8a3ed..96f3911a 100644 --- a/src-tauri/capabilities/TeyvatGuide.json +++ b/src-tauri/capabilities/TeyvatGuide.json @@ -46,6 +46,7 @@ { "identifier": "fs:allow-read-text-file", "allow": [{ "path": "**" }] }, { "identifier": "fs:allow-read-text-file-lines", "allow": [{ "path": "**" }] }, { "identifier": "fs:allow-remove", "allow": [{ "path": "**" }] }, + { "identifier": "fs:allow-copy-file", "allow": [{ "path": "**" }] }, { "identifier": "fs:allow-write-file", "allow": [{ "path": "**" }] }, { "identifier": "fs:allow-write-text-file", "allow": [{ "path": "**" }] }, { "identifier": "opener:allow-open-path", "allow": [{ "path": "**" }] }, diff --git a/src-tauri/src/yae/mod.rs b/src-tauri/src/yae/mod.rs index f55690a9..c4156a2c 100644 --- a/src-tauri/src/yae/mod.rs +++ b/src-tauri/src/yae/mod.rs @@ -74,14 +74,7 @@ pub fn call_yae_dll( uid: String, ticket: Option, ) -> Result<(), String> { - let dll_local_path = - app_handle.path().resource_dir().unwrap().join("resources/YaeAchievementLib.dll"); let dll_path = app_handle.path().app_config_dir().unwrap().join("YaeAchievementLib.dll"); - // -1. 移动 dll 到应用目录以解决权限问题 - match fs::copy(&dll_local_path, &dll_path) { - Ok(_) => println!("✅ DLL 已成功复制到 {:?}", dll_path), - Err(e) => eprintln!("❌ 复制 DLL 失败: {:?}", e), - } dbg!(&dll_path); // 0. 创建 YaeAchievementPipe 的 命名管道,获取句柄 dbg!("开始启动 YaeAchievementPipe 命名管道"); diff --git a/src/components/app/t-sidebar.vue b/src/components/app/t-sidebar.vue index 77bed49d..db548af8 100644 --- a/src/components/app/t-sidebar.vue +++ b/src/components/app/t-sidebar.vue @@ -320,7 +320,7 @@ import { invoke } from "@tauri-apps/api/core"; import type { Event, UnlistenFn } from "@tauri-apps/api/event"; import { exists } from "@tauri-apps/plugin-fs"; import mhyClient from "@utils/TGClient.js"; -import { isRunInAdmin, tryReadGameVer, YAE_GAME_VER } from "@utils/TGGame.js"; +import { isRunInAdmin, tryCopyYae, tryReadGameVer, YAE_GAME_VER } from "@utils/TGGame.js"; import TGLogger from "@utils/TGLogger.js"; import { storeToRefs } from "pinia"; import { computed, onMounted, onUnmounted, ref, shallowRef } from "vue"; @@ -740,6 +740,8 @@ async function tryLaunchGame(): Promise { } return; } + const tryCopy = await tryCopyYae(); + if (!tryCopy) return; try { await invoke("call_yae_dll", { gamePath: gamePath, diff --git a/src/pages/common/PageTest.vue b/src/pages/common/PageTest.vue index e5f0eb1f..9adbdb8c 100644 --- a/src/pages/common/PageTest.vue +++ b/src/pages/common/PageTest.vue @@ -19,12 +19,16 @@