Skip to content

The VS Code of video editing, built for agents.

TypeScript

Enhance project deletion logic to handle non-existent directories

konstantin-paulus68b3095405af
diff --git a/apps/desktop/src/projects.ts b/apps/desktop/src/projects.ts
index bf62c442..5bf04c33 100644
--- a/apps/desktop/src/projects.ts
+++ b/apps/desktop/src/projects.ts
@@ -825,11 +825,16 @@ export async function duplicateProject(dir: string): Promise<ProjectInfo> {
return project;
}
-/** Moves the folder to the trash; resolves with the id it had ("" for none), for what is kept outside it. */
+/**
+ * Moves the folder to the trash; resolves with the id it had ("" for none), for what is kept outside it.
+ * A folder that is already gone counts as deleted, so the project can still come off the list.
+ */
export async function deleteProject(dir: string): Promise<string> {
const id = recordedId(await readPackage(dir));
unwatchProject(dir);
- await shell.trashItem(dir);
+ if (await exists(dir)) {
+ await shell.trashItem(dir);
+ }
return id;
}