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...@@ -92,7 +92,7 @@ pub fn collect_pkgs(mod: u.Module, list: *std.ArrayList(u.Module)) anyerror!void
92 }92 }
93}93}
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 {
96 const p = try std.fs.path.join(gpa, &.{ basedir, try d.clean_path() });96 const p = try std.fs.path.join(gpa, &.{ basedir, try d.clean_path() });
97 const pv = try std.fs.path.join(gpa, &.{ basedir, try d.clean_path_v() });97 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...@@ -208,10 +208,10 @@ pub fn get_module_from_dep(d: *u.Dep, cachepath: []const u8, parent_name: []cons
208 }208 }
209 }209 }
210 }210 }
211 const moddir = try get_moddir(cachepath, d.*, parent_name, options);211 const modpath = try get_modpath(cachepath, d.*, parent_name, options);
212212
213 const nocache = d.type == .local or d.type == .system_lib;213 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
216 switch (d.type) {216 switch (d.type) {
217 .system_lib => {217 .system_lib => {
...@@ -229,16 +229,16 @@ pub fn get_module_from_dep(d: *u.Dep, cachepath: []const u8, parent_name: []cons...@@ -229,16 +229,16 @@ pub fn get_module_from_dep(d: *u.Dep, cachepath: []const u8, parent_name: []cons
229 };229 };
230 },230 },
231 else => {231 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) {
233 error.FileNotFound => {233 error.FileNotFound => {
234 if (d.main.len > 0 or d.c_include_dirs.len > 0 or d.c_source_files.len > 0) {234 if (d.main.len > 0 or d.c_include_dirs.len > 0 or d.c_source_files.len > 0) {
235 var mod_from = try u.Module.from(d.*, cachepath, options);235 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..];
237 if (mod_from.is_for_this()) return mod_from;237 if (mod_from.is_for_this()) return mod_from;
238 return null;238 return null;
239 }239 }
240 const moddirO = try std.fs.cwd().openDir(moddir, .{});240 const moddirO = try std.fs.cwd().openDir(modpath, .{});
241 const tryname = try u.detect_pkgname("", moddir);241 const tryname = try u.detect_pkgname("", modpath);
242 const trymain = u.detct_mainfile("", moddirO, tryname) catch |err| switch (err) {242 const trymain = u.detct_mainfile("", moddirO, tryname) catch |err| switch (err) {
243 error.CantFindMain => null,243 error.CantFindMain => null,
244 else => return err,244 else => return err,
...@@ -247,7 +247,7 @@ pub fn get_module_from_dep(d: *u.Dep, cachepath: []const u8, parent_name: []cons...@@ -247,7 +247,7 @@ pub fn get_module_from_dep(d: *u.Dep, cachepath: []const u8, parent_name: []cons
247 d.*.name = tryname;247 d.*.name = tryname;
248 d.*.main = trymain.?;248 d.*.main = trymain.?;
249 var mod_from = try u.Module.from(d.*, cachepath, options);249 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..];
251 if (mod_from.is_for_this()) return mod_from;251 if (mod_from.is_for_this()) return mod_from;
252 return null;252 return null;
253 }253 }
...@@ -258,7 +258,7 @@ pub fn get_module_from_dep(d: *u.Dep, cachepath: []const u8, parent_name: []cons...@@ -258,7 +258,7 @@ pub fn get_module_from_dep(d: *u.Dep, cachepath: []const u8, parent_name: []cons
258 };258 };
259 dd.dep = d.*;259 dd.dep = d.*;
260 const save = dd;260 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..];
262 if (dd.id.len == 0) dd.id = try u.random_string(48);262 if (dd.id.len == 0) dd.id = try u.random_string(48);
263 if (d.name.len > 0) dd.name = d.name;263 if (d.name.len > 0) dd.name = d.name;
264 if (d.main.len > 0) dd.main = d.main;264 if (d.main.len > 0) dd.main = d.main;