set default path to homedir

This commit is contained in:
Nikita Galaiko 2023-11-14 18:02:26 +01:00 committed by GitButler
parent 5126259f5f
commit e24ebcdbab

View File

@ -1,6 +1,7 @@
<script lang="ts"> <script lang="ts">
import '../styles/main.postcss'; import '../styles/main.postcss';
import { homeDir } from '@tauri-apps/api/path';
import { open } from '@tauri-apps/api/dialog'; import { open } from '@tauri-apps/api/dialog';
import * as toasts from '$lib/utils/toasts'; import * as toasts from '$lib/utils/toasts';
import * as hotkeys from '$lib/utils/hotkeys'; import * as hotkeys from '$lib/utils/hotkeys';
@ -33,8 +34,8 @@
onMount(() => onMount(() =>
unsubscribe( unsubscribe(
events.on('openNewProjectModal', () => events.on('openNewProjectModal', async () =>
open({ directory: true, recursive: true }) open({ directory: true, recursive: true, defaultPath: await homeDir() })
.then((selectedPath) => { .then((selectedPath) => {
if (selectedPath === null) return; if (selectedPath === null) return;
if (Array.isArray(selectedPath) && selectedPath.length !== 1) return; if (Array.isArray(selectedPath) && selectedPath.length !== 1) return;