diff options
| author | Gabriel Schneider <[email protected]> | 2026-08-24 10:56:05 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-08-25 09:42:07 -0300 |
| commit | c3d0b84b7961ae26d2d654e7120821cc2d83d20d (patch) | |
| tree | 0b9a060a8ff0ee7d83c8df5ca797a99e0d66c53e /src/look.zig | |
| parent | 70bde600793ea70bd68832018a154671c6bf1512 (diff) | |
| download | pardes-c3d0b84b7961ae26d2d654e7120821cc2d83d20d.tar.gz pardes-c3d0b84b7961ae26d2d654e7120821cc2d83d20d.zip | |
host: the core owns the event loop; every platform becomes a vtable of optional methods
Diffstat (limited to 'src/look.zig')
| -rw-r--r-- | src/look.zig | 14 |
1 files changed, 9 insertions, 5 deletions
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, }; |
