zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit fa08e49f839d47441af9a1bcf23dc1701849379e (tree)
parent b2c36b14de97a2333a9db761c54ae86bd483cb1d
Author: Andrew Kelley <andrew@ziglang.org>
Date:   Mon,  9 Oct 2023 17:03:17 -0700

Package.Fetch: allow relative paths outside project root

Only for packages that come from the main package. Fetched packages
still cannot depend on paths outside their package root.

Diffstat:
Msrc/Package/Fetch.zig | 5+++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/Package/Fetch.zig b/src/Package/Fetch.zig @@ -257,8 +257,9 @@ pub fn run(f: *Fetch) RunError!void { f.hash_tok, try eb.addString("path-based dependencies are not hashed"), ); - if (std.mem.startsWith(u8, pkg_root.sub_path, "../") or - std.mem.eql(u8, pkg_root.sub_path, "..")) + if ((std.mem.startsWith(u8, pkg_root.sub_path, "../") or + std.mem.eql(u8, pkg_root.sub_path, "..")) and + pkg_root.root_dir.eql(cache_root)) { return f.fail( f.location_tok,