authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-10-09 17:03:17-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-10-09 22:01:18-07:00
logfa08e49f839d47441af9a1bcf23dc1701849379e
tree5a3cc0eccdf00b02dd947f614a3116141d7bd881
parentb2c36b14de97a2333a9db761c54ae86bd483cb1d

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.

1 files changed, 3 insertions(+), 2 deletions(-)

src/Package/Fetch.zig+3-2
...@@ -257,8 +257,9 @@ pub fn run(f: *Fetch) RunError!void {...@@ -257,8 +257,9 @@ pub fn run(f: *Fetch) RunError!void {
257 f.hash_tok,257 f.hash_tok,
258 try eb.addString("path-based dependencies are not hashed"),258 try eb.addString("path-based dependencies are not hashed"),
259 );259 );
260 if (std.mem.startsWith(u8, pkg_root.sub_path, "../") or260 if ((std.mem.startsWith(u8, pkg_root.sub_path, "../") or
261 std.mem.eql(u8, pkg_root.sub_path, ".."))261 std.mem.eql(u8, pkg_root.sub_path, "..")) and
262 pkg_root.root_dir.eql(cache_root))
262 {263 {
263 return f.fail(264 return f.fail(
264 f.location_tok,265 f.location_tok,