fix: misc cleanup

This commit is contained in:
2025-04-23 14:24:35 +00:00
parent 8b2c1a04ee
commit f26d83f291
11 changed files with 89 additions and 59 deletions

View File

@ -32,23 +32,24 @@ export const useGeneralStore = defineStore('general', () => {
},
});
const configDir = computed(() => {
const loadDirs = async () => {
if (dirs.value === null) {
throw new Error('Invalid directory access');
const d = (await invoke('list_directories')) as Dirs;
dirs.value = d;
}
return dirs.value.config_dir;
};
const configDir = computed(async () => {
await loadDirs();
return dirs.value!.config_dir;
});
const dataDir = computed(() => {
if (dirs.value === null) {
throw new Error('Invalid directory access');
}
return dirs.value.data_dir;
const dataDir = computed(async () => {
await loadDirs();
return dirs.value!.data_dir;
});
const cacheDir = computed(() => {
if (dirs.value === null) {
throw new Error('Invalid directory access');
}
return dirs.value.cache_dir;
const cacheDir = computed(async () => {
await loadDirs();
return dirs.value!.cache_dir;
});
return {
@ -322,7 +323,7 @@ export const usePrfStore = defineStore('prf', () => {
const configDir = computed(async () => {
return await path.join(
generalStore.configDir,
await generalStore.configDir,
`profile-${current.value?.meta.game}-${current.value?.meta.name}`
);
});
@ -412,7 +413,7 @@ export const useClientStore = defineStore('client', () => {
const input = JSON.parse(
await readTextFile(
await path.join(
generalStore.configDir,
await generalStore.configDir,
'client-options.json'
)
)
@ -464,7 +465,10 @@ export const useClientStore = defineStore('client', () => {
const size = await w.innerSize();
await writeTextFile(
await path.join(generalStore.configDir, 'client-options.json'),
await path.join(
await generalStore.configDir,
'client-options.json'
),
JSON.stringify({
scaleFactor: scaleFactor.value,
windowSize: {