🐛 修复游戏目录与启动器目录不一致

This commit is contained in:
目棃
2024-09-30 19:44:29 +08:00
parent 9aa789821e
commit 38dbe9366a
2 changed files with 8 additions and 24 deletions

View File

@@ -29,7 +29,7 @@
</div> </div>
</template> </template>
</v-list-item> </v-list-item>
<v-list-item title="启动器安装目录" :subtitle="appStore.gameDir.value"> <v-list-item title="游戏安装目录" :subtitle="appStore.gameDir.value">
<template #prepend> <template #prepend>
<div class="config-icon"> <div class="config-icon">
<v-icon>mdi-gamepad</v-icon> <v-icon>mdi-gamepad</v-icon>
@@ -37,7 +37,7 @@
</template> </template>
<template #append> <template #append>
<div class="config-opers"> <div class="config-opers">
<v-icon @click="confirmCGD()" title="修改启动器安装目录"> mdi-pencil </v-icon> <v-icon @click="confirmCGD()" title="修改游戏安装目录"> mdi-pencil </v-icon>
<v-icon @click="openPath('game')" title="打开游戏安装目录"> mdi-folder-open </v-icon> <v-icon @click="openPath('game')" title="打开游戏安装目录"> mdi-folder-open </v-icon>
<v-icon @click="copyPath('game')" title="复制游戏安装目录"> mdi-content-copy </v-icon> <v-icon @click="copyPath('game')" title="复制游戏安装目录"> mdi-content-copy </v-icon>
</div> </div>
@@ -155,30 +155,13 @@ async function confirmCGD(): Promise<void> {
showSnackbar({ text: "路径未修改!", color: "warn" }); showSnackbar({ text: "路径未修改!", color: "warn" });
return; return;
} }
/// 校验 launcher.exe 跟 games 目录判断是否为合法的启动器路径 // 校验是否存在游戏本体
if (!(await exists(`${dir}${path.sep()}launcher.exe`))) { if (!(await exists(`${dir}${path.sep()}YuanShen.exe`))) {
showSnackbar({ text: "未检测到 launcher.exe", color: "error" }); showSnackbar({ text: "未检测到游戏本体", color: "error" });
return; return;
} }
if (
!(await exists(
`${dir}${path.sep()}games${path.sep()}Genshin Impact Game${path.sep()}YuanShen.exe`,
))
) {
const confirm = await showConfirm({
title: "确认设置为启动器目录?",
text: "未检测到原神本体应用",
});
if (!confirm) {
showSnackbar({
text: oriEmpty ? "取消设置启动器目录" : "取消修改启动器目录",
color: "cancel",
});
return;
}
}
appStore.gameDir.value = dir; appStore.gameDir.value = dir;
showSnackbar({ text: oriEmpty ? "成功设置启动器目录" : "成功修改启动器目录" }); showSnackbar({ text: oriEmpty ? "成功设置游戏目录" : "成功修改游戏目录" });
} }
// 判断是否超过一周 // 判断是否超过一周

View File

@@ -43,6 +43,7 @@ async function refreshAccount(): Promise<void> {
async function tryPlayGame(): Promise<void> { async function tryPlayGame(): Promise<void> {
await refreshAccount(); await refreshAccount();
if (!userStore.uid.value || !userStore.cookie.value) { if (!userStore.uid.value || !userStore.cookie.value) {
showSnackbar({ text: "请先登录!", color: "warn" }); showSnackbar({ text: "请先登录!", color: "warn" });
return; return;
@@ -59,7 +60,7 @@ async function tryPlayGame(): Promise<void> {
showSnackbar({ text: "未设置游戏安装目录!", color: "warn" }); showSnackbar({ text: "未设置游戏安装目录!", color: "warn" });
return; return;
} }
const gamePath = `${appStore.gameDir.value}${path.sep()}games${path.sep()}Genshin Impact Game${path.sep()}YuanShen.exe`; const gamePath = `${appStore.gameDir.value}${path.sep()}YuanShen.exe`;
if (!(await exists(gamePath))) { if (!(await exists(gamePath))) {
showSnackbar({ text: "未检测到原神本体应用!", color: "warn" }); showSnackbar({ text: "未检测到原神本体应用!", color: "warn" });
return; return;