diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index ba8a880..4696821 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -225,12 +225,18 @@ } async function saveProjectAs() { - const folderPath = await open({ - directory: true, - title: 'Choose a folder to save the project', + // Use save dialog so the user can type a new project name. + // The chosen path is treated as the project folder (created if needed). + const defaultName = currentProjectName || 'Untitled'; + const chosenPath = await save({ + defaultPath: defaultName, + title: 'Save Project — enter a project name', }); - if (!folderPath) return; - await saveToFolder(folderPath as string); + if (!chosenPath) return; + + // Strip any file extension the user may have typed (e.g. ".vtn") + const folderPath = chosenPath.replace(/\.[^.\\/]+$/, ''); + await saveToFolder(folderPath); } async function openProject() {