diff options
Diffstat (limited to 'src/fs.zig')
| -rw-r--r-- | src/fs.zig | 13 |
1 files changed, 12 insertions, 1 deletions
@@ -19,7 +19,14 @@ const Reply = tree.Reply; const E = tree.E; /// The served README; tree.zig answers it. -pub const help = @embedFile("fs-help.txt"); +/// The tree's README; a build that embeds no sources lists no src/. +pub const help = help: { + const raw = @embedFile("fs-help.txt"); + if (limits.embedded_sources) break :help raw; + const both = "os/, src/ the host filesystem; the editor's own sources"; + const at = std.mem.indexOf(u8, raw, both) orelse @compileError("fs-help.txt no longer lists os/, src/"); + break :help raw[0..at] ++ "os/ the host filesystem" ++ raw[at + both.len ..]; +}; /// Host filesystem nodes: the root, and one hashed node per path a client walked to. pub const os_root: u64 = (1 << 63) + 2; @@ -1364,3 +1371,7 @@ pub fn unmount(p: *Pardes, name: []const u8) !void { test { _ = tree; } + +test "the tree's README lists src/ only when the build serves it" { + try std.testing.expectEqual(limits.embedded_sources, std.mem.indexOf(u8, help, "src/") != null); +} |
