authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2021-08-21 01:18:23 -07:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2021-08-21 01:18:23 -07:00
log76cb08619f79c914baebd7d5c11d4b453702872d
treefc9efb7ad573c2d6d887780e2f60fbe8cb1a21b4
parentd728c68f7d749d7a64c1d426fd7bbb4b79a4a63b

common- more name cleanup


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

src/common.zig+9-9
......@@ -92,7 +92,7 @@ pub fn collect_pkgs(mod: u.Module, list: *std.ArrayList(u.Module)) anyerror!void
9292 }
9393}
9494
95pub fn get_moddir(basedir: []const u8, d: u.Dep, parent_name: []const u8, options: *CollectOptions) ![]const u8 {
95pub fn get_modpath(basedir: []const u8, d: u.Dep, parent_name: []const u8, options: *CollectOptions) ![]const u8 {
9696 const p = try std.fs.path.join(gpa, &.{ basedir, try d.clean_path() });
9797 const pv = try std.fs.path.join(gpa, &.{ basedir, try d.clean_path_v() });
9898
......@@ -208,10 +208,10 @@ pub fn get_module_from_dep(d: *u.Dep, cachepath: []const u8, parent_name: []cons
208208 }
209209 }
210210 }
211 const moddir = try get_moddir(cachepath, d.*, parent_name, options);
211 const modpath = try get_modpath(cachepath, d.*, parent_name, options);
212212
213213 const nocache = d.type == .local or d.type == .system_lib;
214 if (!nocache) try options.already_fetched.append(moddir);
214 if (!nocache) try options.already_fetched.append(modpath);
215215
216216 switch (d.type) {
217217 .system_lib => {
......@@ -229,16 +229,16 @@ pub fn get_module_from_dep(d: *u.Dep, cachepath: []const u8, parent_name: []cons
229229 };
230230 },
231231 else => {
232 var dd = try collect_deps(cachepath, try u.concat(&.{ moddir, "/zig.mod" }), options) catch |e| switch (e) {
232 var dd = try collect_deps(cachepath, try u.concat(&.{ modpath, "/zig.mod" }), options) catch |e| switch (e) {
233233 error.FileNotFound => {
234234 if (d.main.len > 0 or d.c_include_dirs.len > 0 or d.c_source_files.len > 0) {
235235 var mod_from = try u.Module.from(d.*, cachepath, options);
236 if (d.type != .local) mod_from.clean_path = u.trim_prefix(moddir, cachepath)[1..];
236 if (d.type != .local) mod_from.clean_path = u.trim_prefix(modpath, cachepath)[1..];
237237 if (mod_from.is_for_this()) return mod_from;
238238 return null;
239239 }
240 const moddirO = try std.fs.cwd().openDir(moddir, .{});
241 const tryname = try u.detect_pkgname("", moddir);
240 const moddirO = try std.fs.cwd().openDir(modpath, .{});
241 const tryname = try u.detect_pkgname("", modpath);
242242 const trymain = u.detct_mainfile("", moddirO, tryname) catch |err| switch (err) {
243243 error.CantFindMain => null,
244244 else => return err,
......@@ -247,7 +247,7 @@ pub fn get_module_from_dep(d: *u.Dep, cachepath: []const u8, parent_name: []cons
247247 d.*.name = tryname;
248248 d.*.main = trymain.?;
249249 var mod_from = try u.Module.from(d.*, cachepath, options);
250 if (d.type != .local) mod_from.clean_path = u.trim_prefix(moddir, cachepath)[1..];
250 if (d.type != .local) mod_from.clean_path = u.trim_prefix(modpath, cachepath)[1..];
251251 if (mod_from.is_for_this()) return mod_from;
252252 return null;
253253 }
......@@ -258,7 +258,7 @@ pub fn get_module_from_dep(d: *u.Dep, cachepath: []const u8, parent_name: []cons
258258 };
259259 dd.dep = d.*;
260260 const save = dd;
261 if (d.type != .local) dd.clean_path = u.trim_prefix(moddir, cachepath)[1..];
261 if (d.type != .local) dd.clean_path = u.trim_prefix(modpath, cachepath)[1..];
262262 if (dd.id.len == 0) dd.id = try u.random_string(48);
263263 if (d.name.len > 0) dd.name = d.name;
264264 if (d.main.len > 0) dd.main = d.main;