forked from akanyan/STARTLINER
feat: segatools.ini loading
This commit is contained in:
@ -1,15 +1,19 @@
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue';
|
||||
import Select from 'primevue/select';
|
||||
import { useConfirm } from 'primevue/useconfirm';
|
||||
import * as path from '@tauri-apps/api/path';
|
||||
import FilePicker from '../FilePicker.vue';
|
||||
import OptionCategory from '../OptionCategory.vue';
|
||||
import OptionRow from '../OptionRow.vue';
|
||||
import { invoke } from '../../invoke';
|
||||
import { usePkgStore, usePrfStore } from '../../stores';
|
||||
import { Feature } from '../../types';
|
||||
import { pkgKey } from '../../util';
|
||||
|
||||
const prf = usePrfStore();
|
||||
const pkgs = usePkgStore();
|
||||
const confirmDialog = useConfirm();
|
||||
|
||||
const names = computed(() => {
|
||||
switch (prf.current?.meta.game) {
|
||||
@ -31,6 +35,20 @@ const names = computed(() => {
|
||||
throw new Error('Option tab without a profile');
|
||||
}
|
||||
});
|
||||
|
||||
const checkSegatoolsIni = async (target: string) => {
|
||||
const iniPath = await path.join(target, '../segatools.ini');
|
||||
if (await invoke('file_exists', { path: iniPath })) {
|
||||
confirmDialog.require({
|
||||
message: 'Would you like to load the existing configuration data?',
|
||||
header: 'segatools.ini found',
|
||||
accept: async () => {
|
||||
await invoke('load_segatools_ini', { path: iniPath });
|
||||
await prf.reload();
|
||||
},
|
||||
});
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@ -45,7 +63,10 @@ const names = computed(() => {
|
||||
extension="exe"
|
||||
:value="prf.current!.data.sgt.target"
|
||||
:callback="
|
||||
(value: string) => (prf.current!.data.sgt.target = value)
|
||||
(value: string) => (
|
||||
(prf.current!.data.sgt.target = value),
|
||||
checkSegatoolsIni(value)
|
||||
)
|
||||
"
|
||||
></FilePicker>
|
||||
</OptionRow>
|
||||
|
Reference in New Issue
Block a user