From eec54fdb93a586bb2fcaabddeba2b583f3daa8f5 Mon Sep 17 00:00:00 2001 From: Zef Hemel Date: Fri, 26 Sep 2025 13:20:30 +0200 Subject: [PATCH] handle space.fileExists less on vibes, more on reality --- client/plugos/syscalls/space.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/client/plugos/syscalls/space.ts b/client/plugos/syscalls/space.ts index 77d385c3..da4c070e 100644 --- a/client/plugos/syscalls/space.ts +++ b/client/plugos/syscalls/space.ts @@ -59,8 +59,15 @@ export function spaceReadSyscalls(editor: Client): SysCallMapping { "space.readFile": async (_ctx, name: string): Promise => { return (await editor.space.spacePrimitives.readFile(name)).data; }, - "space.fileExists": (_ctx, name: string): boolean => { - return editor.clientSystem.allKnownFiles.has(name); + "space.fileExists": async (_ctx, name: string): boolean => { + try { + await editor.space.spacePrimitives.getFileMeta(name); + // If this returned the file exists + return true; + } catch { + // Assumption: any error means the file does not exist + return false; + } }, }; }