This repository has been archived on 2024-08-06. You can view files and clone it, but cannot push or open issues or pull requests.
comicinfo-editor-v2/src/lib/PathInput.svelte

35 lines
No EOL
698 B
Svelte

<script lang="ts">
import { open } from '@tauri-apps/api/dialog';
export let path: string;
let buttonPrompt = "Select";
async function handleClick() {
const dirHandle = await open({
multiple: false,
directory: true,
defaultPath: path
});
if (Array.isArray(dirHandle)) {
path = dirHandle[0];
}
else if (dirHandle !== null) {
path = dirHandle;
}
}
</script>
<div>
<button on:click|preventDefault={handleClick}>{buttonPrompt}</button>
{#if path != ""}
<p>{path}</p>
{:else}
<p>Select Save Location...</p>
{/if}
</div>
<style>
</style>