diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2020-09-24 22:15:40 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2020-09-24 22:15:40 -0700 |
| commit | 5440ca8eb7b7078cbca4b89f6540f08b5bb94960 (patch) | |
| tree | 858ae3dfdf9570d5f289a3d5b19d8868f9510266 /src/main.zig | |
| parent | 67463c4357d0d0f43b8962231659fb8a1cc4869a (diff) | |
| download | zig-5440ca8eb7b7078cbca4b89f6540f08b5bb94960.tar.gz zig-5440ca8eb7b7078cbca4b89f6540f08b5bb94960.zip | |
--main-pkg-path properly resolves the relative root src file path
Diffstat (limited to 'src/main.zig')
| -rw-r--r-- | src/main.zig | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/main.zig b/src/main.zig index ca885329d8..be2c55f828 100644 --- a/src/main.zig +++ b/src/main.zig @@ -1276,15 +1276,15 @@ pub fn buildOutputType( defer if (cleanup_root_dir) |*dir| dir.close(); const root_pkg: ?*Package = if (root_src_file) |src_path| blk: { - root_pkg_memory.root_src_directory = m: { - if (main_pkg_path) |p| { - const dir = try fs.cwd().openDir(p, .{}); - cleanup_root_dir = dir; - break :m .{ .path = p, .handle = dir }; - } - break :m .{ .path = null, .handle = fs.cwd() }; - }; - root_pkg_memory.root_src_path = src_path; + if (main_pkg_path) |p| { + const dir = try fs.cwd().openDir(p, .{}); + cleanup_root_dir = dir; + root_pkg_memory.root_src_directory = .{ .path = p, .handle = dir }; + root_pkg_memory.root_src_path = try fs.path.relative(arena, p, src_path); + } else { + root_pkg_memory.root_src_directory = .{ .path = null, .handle = fs.cwd() }; + root_pkg_memory.root_src_path = src_path; + } break :blk &root_pkg_memory; } else null; |
