fix: Microsoft Windows

This commit is contained in:
2025-02-27 01:47:01 +00:00
parent 947b384511
commit 3d96d89846
5 changed files with 30 additions and 9 deletions

View File

@ -5,8 +5,9 @@ import InputNumber from 'primevue/inputnumber';
import InputText from 'primevue/inputtext';
import RadioButton from 'primevue/radiobutton';
import Toggle from 'primevue/toggleswitch';
import { invoke } from '@tauri-apps/api/core';
import * as path from '@tauri-apps/api/path';
import { readTextFile, writeTextFile } from '@tauri-apps/plugin-fs';
import { mkdir, readTextFile, writeTextFile } from '@tauri-apps/plugin-fs';
import { usePkgStore } from '../stores';
const store = usePkgStore();
@ -28,18 +29,19 @@ const cfgAime = _cfg('aime', false);
const aimeCode = ref('');
// temp
let profilePath = '';
let aimePath = '';
(async () => {
aimePath = await path.join(
await path.dataDir(),
'startliner/profile-ongeki-default/aime.txt'
);
aimeCode.value = await readTextFile(aimePath);
profilePath = await invoke('profile_dir');
try {
aimePath = await path.join(profilePath, 'aime.txt');
aimeCode.value = await readTextFile(aimePath);
} catch (_) {
aimeCode.value = '';
}
})();
path.homeDir().then(console.log);
const aimeCodeModel = computed({
get() {
return aimeCode.value;
@ -47,6 +49,7 @@ const aimeCodeModel = computed({
async set(value: string) {
aimeCode.value = value;
if (value.match(/^[0-9]{20}$/)) {
await mkdir(profilePath);
await writeTextFile(aimePath, aimeCode.value);
}
},