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; + } }, }; }