feat: add prelaunch scripts

This commit is contained in:
2025-05-09 16:07:58 +00:00
parent 8f05a04350
commit 469ba5f574
9 changed files with 91 additions and 7 deletions

View File

@ -1,5 +1,5 @@
<script setup lang="ts">
import { ref } from 'vue';
import { onMounted, ref } from 'vue';
import Button from 'primevue/button';
import * as path from '@tauri-apps/api/path';
import { open } from '@tauri-apps/plugin-dialog';
@ -12,6 +12,7 @@ const props = defineProps({
filename: String,
promptname: String,
extension: String,
defaultValue: String,
});
const exists = ref(false);
@ -35,6 +36,12 @@ const save = async () => {
};
const filePick = async () => {
if (props.defaultValue !== undefined) {
contents.value = props.defaultValue;
exists.value = true;
await save();
return;
}
const p = await open({
multiple: false,
directory: false,
@ -54,13 +61,13 @@ const filePick = async () => {
}
};
(async () => {
onMounted(async () => {
if (props.filename === undefined) {
throw new Error('FileEditor without a filename');
}
target_path.value = await path.join(await prf.configDir, props.filename);
await load(target_path.value);
})();
});
</script>
<template>