feat: new error banner, qol

This commit is contained in:
2025-04-04 22:14:09 +00:00
parent ca871f069f
commit 93e0a7e313
7 changed files with 112 additions and 26 deletions

View File

@ -1,7 +1,9 @@
<script setup lang="ts">
import Button from 'primevue/button';
import InputText from 'primevue/inputtext';
import * as path from '@tauri-apps/api/path';
import { open } from '@tauri-apps/plugin-dialog';
import { usePrfStore } from '../stores';
const props = defineProps({
placeholder: String,
@ -12,10 +14,25 @@ const props = defineProps({
callback: Function,
});
const prf = usePrfStore();
const filePick = async () => {
const exePath = prf.current?.data.sgt.target;
let defaultPath: string | undefined;
if (
exePath !== undefined &&
exePath.length > 0 &&
props.value !== undefined &&
!(await path.isAbsolute(props.value))
) {
defaultPath = await path.join(exePath, '..');
defaultPath = await path.join(defaultPath, props.value);
defaultPath = await path.join(defaultPath, '..');
}
const res = await open({
multiple: false,
directory: props.directory,
defaultPath,
filters:
props.promptname && props.extension
? [
@ -28,7 +45,7 @@ const filePick = async () => {
});
if (res != null && props.callback !== undefined) {
props.callback(res);
/*path.relative(cfgs.current?.data.exe_dir ?? '', res) */
/*path.relative(prf.current?.data.sgt.target ?? '', res) */
}
};
</script>