aboutsummaryrefslogtreecommitdiff
path: root/src/main.zig
diff options
context:
space:
mode:
authorVexu <git@vexu.eu>2020-09-30 18:02:00 +0300
committerVexu <git@vexu.eu>2020-09-30 18:03:10 +0300
commit6d3858dc8a5e5d510a6c9cc972357dda551628b3 (patch)
treeba3a2c2147601a7fa39eb4b71897bd33a7b1a5d1 /src/main.zig
parentd819da4350cc4325a7281ebeaf6057586b8eb0d7 (diff)
downloadzig-6d3858dc8a5e5d510a6c9cc972357dda551628b3.tar.gz
zig-6d3858dc8a5e5d510a6c9cc972357dda551628b3.zip
stage2: use directory handles for imports
Diffstat (limited to 'src/main.zig')
-rw-r--r--src/main.zig5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/main.zig b/src/main.zig
index d421322c17..5b83bac9ca 100644
--- a/src/main.zig
+++ b/src/main.zig
@@ -1446,6 +1446,11 @@ fn buildOutputType(
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 if (fs.path.dirname(src_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 = fs.path.basename(src_path);
} else {
root_pkg_memory.root_src_directory = .{ .path = null, .handle = fs.cwd() };
root_pkg_memory.root_src_path = src_path;