mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2025-12-12 09:18:14 +08:00
fix(merge): 相关页面添加 merge 目录处理
This commit is contained in:
@@ -15,7 +15,7 @@
|
||||
import { defineComponent } from "vue";
|
||||
import TSidebar from "./components/t-sidebar.vue";
|
||||
import useAppStore from "./store/modules/app";
|
||||
import TGAppData from "./data";
|
||||
import { TGAppDataList } from "./data";
|
||||
import { fs } from "@tauri-apps/api";
|
||||
import { BaseDirectory } from "@tauri-apps/api/fs";
|
||||
|
||||
@@ -30,12 +30,14 @@ export default defineComponent({
|
||||
try {
|
||||
await fs.readDir(`${appStore.dataPath.app}`);
|
||||
await fs.readDir(`${appStore.dataPath.user}`);
|
||||
await fs.readDir(`${appStore.dataPath.merge}`);
|
||||
} catch (e) {
|
||||
await fs.createDir("appData", { dir: BaseDirectory.AppLocalData });
|
||||
await fs.createDir("userData", { dir: BaseDirectory.AppLocalData });
|
||||
await fs.createDir("mergeData", { dir: BaseDirectory.AppLocalData });
|
||||
}
|
||||
await console.log("检测到数据未加载,开始加载数据...");
|
||||
TGAppData.map(async item => {
|
||||
TGAppDataList.map(async item => {
|
||||
await fs.writeFile(
|
||||
`${appStore.dataPath.app}\\${item.name}`,
|
||||
JSON.stringify(item.data, null, 2)
|
||||
|
||||
@@ -46,8 +46,13 @@ export default defineComponent({
|
||||
dir: BaseDirectory.AppLocalData,
|
||||
recursive: true,
|
||||
});
|
||||
await fs.removeDir("mergeData", {
|
||||
dir: BaseDirectory.AppLocalData,
|
||||
recursive: true,
|
||||
});
|
||||
await dialog.message("用户数据已删除!");
|
||||
await fs.createDir("userData", { dir: BaseDirectory.AppLocalData });
|
||||
await fs.createDir("mergeData", { dir: BaseDirectory.AppLocalData });
|
||||
}
|
||||
},
|
||||
// 恢复默认配置
|
||||
|
||||
Reference in New Issue
Block a user