authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-09-24 22:15:40-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-09-24 22:15:40-07:00
log5440ca8eb7b7078cbca4b89f6540f08b5bb94960
tree858ae3dfdf9570d5f289a3d5b19d8868f9510266
parent67463c4357d0d0f43b8962231659fb8a1cc4869a

--main-pkg-path properly resolves the relative root src file path


1 files changed, 9 insertions(+), 9 deletions(-)

src/main.zig+9-9
......@@ -1276,15 +1276,15 @@ pub fn buildOutputType(
12761276 defer if (cleanup_root_dir) |*dir| dir.close();
12771277
12781278 const root_pkg: ?*Package = if (root_src_file) |src_path| blk: {
1279 root_pkg_memory.root_src_directory = m: {
1280 if (main_pkg_path) |p| {
1281 const dir = try fs.cwd().openDir(p, .{});
1282 cleanup_root_dir = dir;
1283 break :m .{ .path = p, .handle = dir };
1284 }
1285 break :m .{ .path = null, .handle = fs.cwd() };
1286 };
1287 root_pkg_memory.root_src_path = src_path;
1279 if (main_pkg_path) |p| {
1280 const dir = try fs.cwd().openDir(p, .{});
1281 cleanup_root_dir = dir;
1282 root_pkg_memory.root_src_directory = .{ .path = p, .handle = dir };
1283 root_pkg_memory.root_src_path = try fs.path.relative(arena, p, src_path);
1284 } else {
1285 root_pkg_memory.root_src_directory = .{ .path = null, .handle = fs.cwd() };
1286 root_pkg_memory.root_src_path = src_path;
1287 }
12881288 break :blk &root_pkg_memory;
12891289 } else null;
12901290