| ... | ... | @@ -1,5 +1,6 @@ |
| 1 | 1 | const std = @import("std"); |
| 2 | 2 | const gpa = std.heap.c_allocator; |
| 3 | const fs = std.fs; |
| 3 | 4 | |
| 4 | 5 | const known_folders = @import("known-folders"); |
| 5 | 6 | const u = @import("./util/index.zig"); |
| ... | ... | @@ -10,12 +11,12 @@ const u = @import("./util/index.zig"); |
| 10 | 11 | pub fn execute(args: [][]u8) !void { |
| 11 | 12 | // |
| 12 | 13 | const home = try known_folders.getPath(gpa, .home); |
| 13 | | const dir = try std.fs.path.join(gpa, &[_][]const u8{home.?, ".cache", "zigmod", "deps"}); |
| 14 | const dir = try fs.path.join(gpa, &[_][]const u8{home.?, ".cache", "zigmod", "deps"}); |
| 14 | 15 | |
| 15 | 16 | const top_module = try fetch_deps(dir, "./zig.mod"); |
| 16 | 17 | |
| 17 | 18 | // |
| 18 | | const f = try std.fs.cwd().createFile("./deps.zig", .{}); |
| 19 | const f = try fs.cwd().createFile("./deps.zig", .{}); |
| 19 | 20 | defer f.close(); |
| 20 | 21 | |
| 21 | 22 | const w = f.writer(); |
| ... | ... | @@ -155,7 +156,7 @@ fn fetch_deps(dir: []const u8, mpath: []const u8) anyerror!u.Module { |
| 155 | 156 | }; |
| 156 | 157 | } |
| 157 | 158 | |
| 158 | | fn print_deps(w: std.fs.File.Writer, dir: []const u8, m: u.Module, tabs: i32) anyerror!void { |
| 159 | fn print_deps(w: fs.File.Writer, dir: []const u8, m: u.Module, tabs: i32) anyerror!void { |
| 159 | 160 | if (m.deps.len == 0 and tabs > 0) { |
| 160 | 161 | try w.print("null", .{}); |
| 161 | 162 | return; |
| ... | ... | @@ -178,8 +179,8 @@ fn print_deps(w: std.fs.File.Writer, dir: []const u8, m: u.Module, tabs: i32) an |
| 178 | 179 | try w.print("{}", .{try u.concat(&[_][]const u8{r,"}"})}); |
| 179 | 180 | } |
| 180 | 181 | |
| 181 | | fn print_incl_dirs_to(w: std.fs.File.Writer, mod: u.Module, list: *std.ArrayList([]const u8), local: bool) anyerror!void { |
| 182 | 182 | if (u.list_contains(list, mod.clean_path)) { |
| 183 | fn print_incl_dirs_to(w: fs.File.Writer, mod: u.Module, list: *std.ArrayList([]const u8), local: bool) anyerror!void { |
| 183 | 184 | return; |
| 184 | 185 | } |
| 185 | 186 | try list.append(mod.clean_path); |
| ... | ... | @@ -195,8 +196,8 @@ fn print_incl_dirs_to(w: std.fs.File.Writer, mod: u.Module, list: *std.ArrayList |
| 195 | 196 | } |
| 196 | 197 | } |
| 197 | 198 | |
| 198 | | fn print_csrc_dirs_to(w: std.fs.File.Writer, mod: u.Module, list: *std.ArrayList([]const u8), local: bool) anyerror!void { |
| 199 | 199 | if (u.list_contains(list, mod.clean_path)) { |
| 200 | fn print_csrc_dirs_to(w: fs.File.Writer, mod: u.Module, list: *std.ArrayList([]const u8), local: bool) anyerror!void { |
| 200 | 201 | return; |
| 201 | 202 | } |
| 202 | 203 | try list.append(mod.clean_path); |
| ... | ... | @@ -212,8 +213,8 @@ fn print_csrc_dirs_to(w: std.fs.File.Writer, mod: u.Module, list: *std.ArrayList |
| 212 | 213 | } |
| 213 | 214 | } |
| 214 | 215 | |
| 215 | | fn print_csrc_flags_to(w: std.fs.File.Writer, mod: u.Module, list: *std.ArrayList([]const u8), local: bool) anyerror!void { |
| 216 | 216 | if (u.list_contains(list, mod.clean_path)) { |
| 217 | fn print_csrc_flags_to(w: fs.File.Writer, mod: u.Module, list: *std.ArrayList([]const u8), local: bool) anyerror!void { |
| 217 | 218 | return; |
| 218 | 219 | } |
| 219 | 220 | try list.append(mod.clean_path); |