diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2022-05-05 22:17:21 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2022-05-06 22:41:00 -0700 |
| commit | 3b60ab4872355f0b9a9c7d0794ca8b548ab99412 (patch) | |
| tree | a5fd44fa180714d5f16eaba89ed34dc9b3829041 /src/Package.zig | |
| parent | f034cef262ed050551bc5c36d710263950e5eb27 (diff) | |
| download | zig-3b60ab4872355f0b9a9c7d0794ca8b548ab99412.tar.gz zig-3b60ab4872355f0b9a9c7d0794ca8b548ab99412.zip | |
stage2: fix std lib tests always filtering out all tests
Diffstat (limited to 'src/Package.zig')
| -rw-r--r-- | src/Package.zig | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/Package.zig b/src/Package.zig index df894280a9..9ac1e2e5b1 100644 --- a/src/Package.zig +++ b/src/Package.zig @@ -124,3 +124,11 @@ pub fn addAndAdopt(parent: *Package, gpa: Allocator, name: []const u8, child: *P child.parent = parent; return parent.add(gpa, name, child); } + +pub fn isInsideOf(pkg: Package, another: Package) !bool { + var pkg_buffer: [std.fs.MAX_PATH_BYTES]u8 = undefined; + var another_buffer: [std.fs.MAX_PATH_BYTES]u8 = undefined; + const pkg_path = try pkg.root_src_directory.handle.realpath(pkg.root_src_path, &pkg_buffer); + const another_path = try another.root_src_directory.handle.realpath(".", &another_buffer); + return mem.startsWith(u8, pkg_path, another_path); +} |
