authorgravatar for hello@nektro.netMeghan <hello@nektro.net> 2020-11-20 14:11:12 -08:00
committergravatar for hello@nektro.netMeghan <hello@nektro.net> 2020-11-20 14:11:12 -08:00
log73af129674c57d49efa4a19eec523bd36079bcec
tree809ddeee1d0d0079883c8ce65e2b5c64347fee93
parent96ae02db8af8a0024a109fcf5809e335f3bd4ad7

fetch: fix logic of still adding c files when dep doesnt have zig.mod file


1 files changed, 12 insertions(+), 10 deletions(-)

src/cmd_fetch.zig+12-10
......@@ -110,16 +110,18 @@ fn fetch_deps(dir: []const u8, mpath: []const u8) anyerror!u.Module {
110110 },
111111 }
112112 switch (d.type) {
113 else => {
114 if (d.main.len == 0) {
115 if (d.c_include_dirs.len > 0 or d.c_source_files.len > 0) {
116 var mod_from = try u.Module.from(d);
117 mod_from.clean_path = u.trim_prefix(moddir, dir)[1..];
118 try moduledeps.append(mod_from);
119 }
120 break;
121 }
122 var dd = try fetch_deps(dir, try u.concat(&[_][]const u8{moddir, "/zig.mod"}));
113 else => blk: {
114 var dd = try fetch_deps(dir, try u.concat(&[_][]const u8{moddir, "/zig.mod"})) catch |e| switch (e) {
115 error.FileNotFound => {
116 if (d.c_include_dirs.len > 0 or d.c_source_files.len > 0) {
117 var mod_from = try u.Module.from(d);
118 mod_from.clean_path = u.trim_prefix(moddir, dir)[1..];
119 try moduledeps.append(mod_from);
120 }
121 break :blk;
122 },
123 else => e,
124 };
123125 dd.clean_path = u.trim_prefix(moddir, dir)[1..];
124126
125127 if (d.name.len > 0) dd.name = d.name;