authorgravatar for hello@nektro.netMeghan <hello@nektro.net> 2020-12-15 06:25:58 -08:00
committergravatar for hello@nektro.netMeghan <hello@nektro.net> 2020-12-15 06:25:58 -08:00
log974ee20698d91b7b2f9cad2e6119e10ebdc26be0
tree89980f2c9e848982d4e6dd83b286863b15530488
parentb1ae787068abcd16df20c7cbe9832f344e45fe94

add dep.clean_path_v


2 files changed, 8 insertions(+), 1 deletions(-)

src/cmd_fetch.zig+1-1
...@@ -78,7 +78,7 @@ fn fetch_deps(dir: []const u8, mpath: []const u8) anyerror!u.Module {...@@ -78,7 +78,7 @@ fn fetch_deps(dir: []const u8, mpath: []const u8) anyerror!u.Module {
78 var moddir: []const u8 = undefined;78 var moddir: []const u8 = undefined;
79 for (m.deps) |d| {79 for (m.deps) |d| {
80 const p = try fs.path.join(gpa, &[_][]const u8{dir, try d.clean_path()});80 const p = try fs.path.join(gpa, &[_][]const u8{dir, try d.clean_path()});
81 const pv = try fs.path.join(gpa, &[_][]const u8{dir, "v", try d.clean_path(), d.version});81 const pv = try fs.path.join(gpa, &[_][]const u8{dir, try d.clean_path_v()});
82 u.print("fetch: {}: {}: {}", .{m.name, @tagName(d.type), d.path});82 u.print("fetch: {}: {}: {}", .{m.name, @tagName(d.type), d.path});
83 moddir = p;83 moddir = p;
84 switch (d.type) {84 switch (d.type) {
src/util/dep.zig+7
...@@ -32,6 +32,13 @@ pub const Dep = struct {...@@ -32,6 +32,13 @@ pub const Dep = struct {
32 return p;32 return p;
33 }33 }
3434
35 pub fn clean_path_v(self: Dep) ![]const u8 {
36 if (self.type == .http and self.version.len > 0) {
37 return std.fs.path.join(gpa, &[_][]const u8{"v", @tagName(self.type), self.version});
38 }
39 return std.fs.path.join(gpa, &[_][]const u8{"v", try self.clean_path(), self.version});
40 }
41
35 pub fn is_for_this(self: Dep) bool {42 pub fn is_for_this(self: Dep) bool {
36 const os = @tagName(builtin.os.tag);43 const os = @tagName(builtin.os.tag);
37 if (self.only_os.len > 0) {44 if (self.only_os.len > 0) {