🎨 调整检测逻辑,存在时不复制

This commit is contained in:
BTMuli
2026-01-21 18:20:59 +08:00
parent 88bdccec43
commit 19b2615d6a

View File

@@ -1,6 +1,6 @@
/**
* 游戏文件相关功能
* @since Beta v0.9.2
* @since Beta v0.9.4
*/
import showDialog from "@comp/func/dialog.js";
@@ -62,20 +62,16 @@ export async function isRunInAdmin(): Promise<boolean> {
/**
* 尝试移动dll
* @since Beta v0.9.2
* @returns 无返回值
* @since Beta v0.9.4
* @returns 是否存在 YaeAchievementLib.dll
*/
export async function tryCopyYae(): Promise<boolean> {
const srcDllPath = `${await resourceDir()}${sep()}resources${sep()}YaeAchievementLib.dll`;
const srcCheck = await exists(srcDllPath);
if (!srcCheck) {
showSnackbar.warn("未检测到本地 dll");
return false;
}
const targetDir = `${await documentDir()}${sep()}TeyvatGuide`;
await mkdir(targetDir, { recursive: true });
const targetPath = `${targetDir}${sep()}YaeAchievementLib.dll`;
console.log(targetPath);
const check = await exists(targetPath);
if (check) return true;
await mkdir(targetDir, { recursive: true });
const srcDllPath = `${await resourceDir()}${sep()}resources${sep()}YaeAchievementLib.dll`;
await copyFile(srcDllPath, targetPath);
const check2 = await exists(targetPath);
if (!check2) {