From c3d0b84b7961ae26d2d654e7120821cc2d83d20d Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Mon, 24 Aug 2026 10:56:05 -0300 Subject: host: the core owns the event loop; every platform becomes a vtable of optional methods --- src/look.zig | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'src/look.zig') diff --git a/src/look.zig b/src/look.zig index ece2ee0f..fbcc80a9 100644 --- a/src/look.zig +++ b/src/look.zig @@ -17,10 +17,9 @@ const libc = std.c; const pardes = @import("pardes.zig"); const config = @import("config.zig"); const pdf_enabled = @import("pardes_config").mupdf; -const embedded_sources = if (pardes.platform == .web) @import("embedded_sources") else struct { - pub const Source = struct { path: []const u8, contents: []const u8 }; - pub const all = [_]Source{}; -}; +/// The virtual filesystem, on every platform: the browser has only this, and +/// `run-isolated` chooses it (see `isolated` below). +const embedded_sources = @import("source_manifest.zig"); extern "c" fn realpath(path: [*:0]const u8, resolved: [*]u8) ?[*:0]u8; extern "c" fn fork() c_int; @@ -557,7 +556,12 @@ fn findEmbeddedSource(path: []const u8, allow_root_suffix: bool) ?embedded_sourc return null; } -const platform_has_fs = switch (pardes.platform) { +/// Whether there is a real filesystem to reach at all. An ISOLATED build has +/// none by construction — the option is comptime, so every libc path below is +/// dead code the compiler removes rather than a branch that could be taken by +/// accident. The browser has never had one either, and both then read the same +/// embedded source. +const platform_has_fs = !pardes.isolated and switch (pardes.platform) { .tty, .gui, .macos => true, .web => false, }; -- cgit v1.3