handle space.fileExists less on vibes, more on reality

This commit is contained in:
Zef Hemel
2025-09-26 13:20:30 +02:00
parent bb62127517
commit eec54fdb93
+9 -2
View File
@@ -59,8 +59,15 @@ export function spaceReadSyscalls(editor: Client): SysCallMapping {
"space.readFile": async (_ctx, name: string): Promise<Uint8Array> => {
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;
}
},
};
}