mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2026-05-21 05:25:45 +08:00
🎨 调整检测逻辑,存在时不复制
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* 游戏文件相关功能
|
* 游戏文件相关功能
|
||||||
* @since Beta v0.9.2
|
* @since Beta v0.9.4
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import showDialog from "@comp/func/dialog.js";
|
import showDialog from "@comp/func/dialog.js";
|
||||||
@@ -62,20 +62,16 @@ export async function isRunInAdmin(): Promise<boolean> {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 尝试移动dll
|
* 尝试移动dll
|
||||||
* @since Beta v0.9.2
|
* @since Beta v0.9.4
|
||||||
* @returns 无返回值
|
* @returns 是否存在 YaeAchievementLib.dll
|
||||||
*/
|
*/
|
||||||
export async function tryCopyYae(): Promise<boolean> {
|
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`;
|
const targetDir = `${await documentDir()}${sep()}TeyvatGuide`;
|
||||||
await mkdir(targetDir, { recursive: true });
|
|
||||||
const targetPath = `${targetDir}${sep()}YaeAchievementLib.dll`;
|
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);
|
await copyFile(srcDllPath, targetPath);
|
||||||
const check2 = await exists(targetPath);
|
const check2 = await exists(targetPath);
|
||||||
if (!check2) {
|
if (!check2) {
|
||||||
|
|||||||
Reference in New Issue
Block a user