authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2026-05-30 03:40:25 -07:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2026-05-30 03:40:25 -07:00
logbb7bbbfac7327dae81e6a4fac296e6609afa712b
treed0f92a95946e5ef7468c0d78288b3d8302997070
parent58a16988c07c79a81598ace7b11975a6b4243a30
signaturebadge-check Signed by SSH key SHA256:4hHJbtBRU58AYXwjL7fkz2fnQHdiye8x1QpTCQ0sHNw

remove a bunch of zig-extras functions


9 files changed, 60 insertions(+), 50 deletions(-)

deps.zig+12-12
...@@ -58,7 +58,7 @@ pub fn fetch(exe: *std.Build.Step.Compile) *std.Build.Step {...@@ -58,7 +58,7 @@ pub fn fetch(exe: *std.Build.Step.Compile) *std.Build.Step {
58 step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/arqv-ini", "ab427a4de4f875eaa39ee56a29114fc020431546").step);58 step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/arqv-ini", "ab427a4de4f875eaa39ee56a29114fc020431546").step);
59 step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-ansi", "5f89211a749aef6bf518889c0467ceb24825c055").step);59 step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-ansi", "5f89211a749aef6bf518889c0467ceb24825c055").step);
60 step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-detect-license", "a1a066da88dab50873a56f0349dc12dc76542077").step);60 step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-detect-license", "a1a066da88dab50873a56f0349dc12dc76542077").step);
61 step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-extras", "b3457b31a1d1ea2c19c5d0b007c903d3e80add40").step);61 step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-extras", "0cf756c80a4bc1b0459bc81bf8071891f12c3738").step);
62 step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-git", "2b3f83cd341764f979969603e4f77e62f353b6a3").step);62 step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-git", "2b3f83cd341764f979969603e4f77e62f353b6a3").step);
63 step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-inquirer", "4cddefa42744d61067567b0b36b5d2bb376e5ae3").step);63 step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-inquirer", "4cddefa42744d61067567b0b36b5d2bb376e5ae3").step);
64 step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-intrusive-parser", "a31b480914d15f3d13cdfb586aac950c73beebdd").step);64 step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-intrusive-parser", "a31b480914d15f3d13cdfb586aac950c73beebdd").step);
...@@ -66,13 +66,13 @@ pub fn fetch(exe: *std.Build.Step.Compile) *std.Build.Step {...@@ -66,13 +66,13 @@ pub fn fetch(exe: *std.Build.Step.Compile) *std.Build.Step {
66 step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-leven", "618eddde4ffbc6d34100e4bc6aa654d41161537a").step);66 step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-leven", "618eddde4ffbc6d34100e4bc6aa654d41161537a").step);
67 step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-licenses", "16cef5e32b3f8bbcf1064c599615290a720b6547").step);67 step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-licenses", "16cef5e32b3f8bbcf1064c599615290a720b6547").step);
68 step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-licenses-text", "ba0f00dfb23d28c301e4b54d0a278def2c38dc7b").step);68 step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-licenses-text", "ba0f00dfb23d28c301e4b54d0a278def2c38dc7b").step);
69 step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-nfs", "c855473c8bd15dd24a4e8b6911b7e006062004ba").step);69 step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-nfs", "c61b820567505899198bb425c2b7c459a1f3cce2").step);
70 step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-nio", "c1da2e8a31858880eb3e4cfcf12de0a865617623").step);70 step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-nio", "c1da2e8a31858880eb3e4cfcf12de0a865617623").step);
71 step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-sys-darwin", "3265d1f06418eb0360d753c12116310a14b97bde").step);71 step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-sys-darwin", "c8ef1a85dfb5e1891454650f88d56bfaa0834304").step);
72 step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-sys-linux", "f0b155d3627f8c19868be1b2f15d71cda908b575").step);72 step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-sys-linux", "f0b155d3627f8c19868be1b2f15d71cda908b575").step);
73 step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-time", "0f4db4c980146e4a3fc86a9a9070452a25ff9317").step);73 step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-time", "0f4db4c980146e4a3fc86a9a9070452a25ff9317").step);
74 step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-tracer", "3a5fdea4ffd387a53ac2a42fb503557cdbe20696").step);74 step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-tracer", "3a5fdea4ffd387a53ac2a42fb503557cdbe20696").step);
75 step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-yaml", "00e899bec815bc2b49c6e5a72a7cfeeda673e133").step);75 step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-yaml", "1dbb8eec4059e6b49e9a590300355f8090c681c7").step);
76 step.dependOn(&GitExactStep.create(b, "https://github.com/madler/zlib", "da607da739fa6047df13e66a2af6b8bec7c2a498").step);76 step.dependOn(&GitExactStep.create(b, "https://github.com/madler/zlib", "da607da739fa6047df13e66a2af6b8bec7c2a498").step);
77 step.dependOn(&GitExactStep.create(b, "https://github.com/yaml/libyaml", "2c891fc7a770e8ba2fec34fc6b545c672beb37e6").step);77 step.dependOn(&GitExactStep.create(b, "https://github.com/yaml/libyaml", "2c891fc7a770e8ba2fec34fc6b545c672beb37e6").step);
78 step.dependOn(&GitExactStep.create(b, "https://github.com/ziglibs/known-folders", "aa24df42183ad415d10bc0a33e6238c437fc0f59").step);78 step.dependOn(&GitExactStep.create(b, "https://github.com/ziglibs/known-folders", "aa24df42183ad415d10bc0a33e6238c437fc0f59").step);
...@@ -202,9 +202,9 @@ pub const package_data = struct {...@@ -202,9 +202,9 @@ pub const package_data = struct {
202 .entry = "/git/github.com/nektro/zig-ansi/5f89211a749aef6bf518889c0467ceb24825c055/src/lib.zig",202 .entry = "/git/github.com/nektro/zig-ansi/5f89211a749aef6bf518889c0467ceb24825c055/src/lib.zig",
203 };203 };
204 pub var _f7dubzb7cyqe = Package{204 pub var _f7dubzb7cyqe = Package{
205 .store = "/git/github.com/nektro/zig-extras/b3457b31a1d1ea2c19c5d0b007c903d3e80add40",205 .store = "/git/github.com/nektro/zig-extras/0cf756c80a4bc1b0459bc81bf8071891f12c3738",
206 .name = "extras",206 .name = "extras",
207 .entry = "/git/github.com/nektro/zig-extras/b3457b31a1d1ea2c19c5d0b007c903d3e80add40/src/lib.zig",207 .entry = "/git/github.com/nektro/zig-extras/0cf756c80a4bc1b0459bc81bf8071891f12c3738/src/lib.zig",
208 };208 };
209 pub var _c1xirp1ota5p = Package{209 pub var _c1xirp1ota5p = Package{
210 .store = "/git/github.com/nektro/zig-inquirer/4cddefa42744d61067567b0b36b5d2bb376e5ae3",210 .store = "/git/github.com/nektro/zig-inquirer/4cddefa42744d61067567b0b36b5d2bb376e5ae3",
...@@ -223,9 +223,9 @@ pub const package_data = struct {...@@ -223,9 +223,9 @@ pub const package_data = struct {
223 .entry = "/git/github.com/nektro/zig-licenses/16cef5e32b3f8bbcf1064c599615290a720b6547/src/lib.zig",223 .entry = "/git/github.com/nektro/zig-licenses/16cef5e32b3f8bbcf1064c599615290a720b6547/src/lib.zig",
224 };224 };
225 pub var _73bukkeci2u6 = Package{225 pub var _73bukkeci2u6 = Package{
226 .store = "/git/github.com/nektro/zig-sys-darwin/3265d1f06418eb0360d753c12116310a14b97bde",226 .store = "/git/github.com/nektro/zig-sys-darwin/c8ef1a85dfb5e1891454650f88d56bfaa0834304",
227 .name = "sys-darwin",227 .name = "sys-darwin",
228 .entry = "/git/github.com/nektro/zig-sys-darwin/3265d1f06418eb0360d753c12116310a14b97bde/sys_darwin.zig",228 .entry = "/git/github.com/nektro/zig-sys-darwin/c8ef1a85dfb5e1891454650f88d56bfaa0834304/sys_darwin.zig",
229 };229 };
230 pub var _h7tv7ayhffak = Package{230 pub var _h7tv7ayhffak = Package{
231 .store = "/git/github.com/nektro/zig-sys-linux/f0b155d3627f8c19868be1b2f15d71cda908b575",231 .store = "/git/github.com/nektro/zig-sys-linux/f0b155d3627f8c19868be1b2f15d71cda908b575",
...@@ -253,9 +253,9 @@ pub const package_data = struct {...@@ -253,9 +253,9 @@ pub const package_data = struct {
253 .deps = &[_]*Package{ &_f7dubzb7cyqe, &_h7tv7ayhffak, &_73bukkeci2u6 },253 .deps = &[_]*Package{ &_f7dubzb7cyqe, &_h7tv7ayhffak, &_73bukkeci2u6 },
254 };254 };
255 pub var _vph9l0hxpeze = Package{255 pub var _vph9l0hxpeze = Package{
256 .store = "/git/github.com/nektro/zig-nfs/c855473c8bd15dd24a4e8b6911b7e006062004ba",256 .store = "/git/github.com/nektro/zig-nfs/c61b820567505899198bb425c2b7c459a1f3cce2",
257 .name = "nfs",257 .name = "nfs",
258 .entry = "/git/github.com/nektro/zig-nfs/c855473c8bd15dd24a4e8b6911b7e006062004ba/nfs.zig",258 .entry = "/git/github.com/nektro/zig-nfs/c61b820567505899198bb425c2b7c459a1f3cce2/nfs.zig",
259 .deps = &[_]*Package{ &_h7tv7ayhffak, &_kscsl0145t7x, &_iecwp4b3bsfm, &_73bukkeci2u6 },259 .deps = &[_]*Package{ &_h7tv7ayhffak, &_kscsl0145t7x, &_iecwp4b3bsfm, &_73bukkeci2u6 },
260 };260 };
261 pub var _ede2wygpe1iy = Package{261 pub var _ede2wygpe1iy = Package{
...@@ -289,9 +289,9 @@ pub const package_data = struct {...@@ -289,9 +289,9 @@ pub const package_data = struct {
289 .deps = &[_]*Package{ &_pt88y5d80m25, &_96h80ezrvj7i },289 .deps = &[_]*Package{ &_pt88y5d80m25, &_96h80ezrvj7i },
290 };290 };
291 pub var _g982zq6e8wsv = Package{291 pub var _g982zq6e8wsv = Package{
292 .store = "/git/github.com/nektro/zig-yaml/00e899bec815bc2b49c6e5a72a7cfeeda673e133",292 .store = "/git/github.com/nektro/zig-yaml/1dbb8eec4059e6b49e9a590300355f8090c681c7",
293 .name = "yaml",293 .name = "yaml",
294 .entry = "/git/github.com/nektro/zig-yaml/00e899bec815bc2b49c6e5a72a7cfeeda673e133/yaml.zig",294 .entry = "/git/github.com/nektro/zig-yaml/1dbb8eec4059e6b49e9a590300355f8090c681c7/yaml.zig",
295 .deps = &[_]*Package{ &_8mdbh0zuneb0 },295 .deps = &[_]*Package{ &_8mdbh0zuneb0 },
296 };296 };
297 pub var _0e2d06bb494b = Package{297 pub var _0e2d06bb494b = Package{
src/cmd/fetch.zig+1-1
...@@ -206,7 +206,7 @@ const DiffChange = struct {...@@ -206,7 +206,7 @@ const DiffChange = struct {
206fn diff_lockfile(alloc: std.mem.Allocator) !void {206fn diff_lockfile(alloc: std.mem.Allocator) !void {
207 const max = std.math.maxInt(usize);207 const max = std.math.maxInt(usize);
208208
209 if (try extras.doesFolderExist(null, ".git")) {209 if (try nfs.cwd().existsDir(".git")) {
210 const result = try u.run_cmd_raw(alloc, null, &.{ "git", "diff", "zigmod.lock" });210 const result = try u.run_cmd_raw(alloc, null, &.{ "git", "diff", "zigmod.lock" });
211 var stdout = std.io.fixedBufferStream(result.stdout);211 var stdout = std.io.fixedBufferStream(result.stdout);
212 const r = stdout.reader();212 const r = stdout.reader();
src/cmd/init.zig+12-11
...@@ -39,7 +39,7 @@ pub fn execute(self_name: []const u8, args: [][:0]u8) !void {...@@ -39,7 +39,7 @@ pub fn execute(self_name: []const u8, args: [][:0]u8) !void {
39 const flatname = try gpa.dupe(u8, name);39 const flatname = try gpa.dupe(u8, name);
40 _ = std.mem.replaceScalar(u8, flatname, '-', '_');40 _ = std.mem.replaceScalar(u8, flatname, '-', '_');
4141
42 const entry_bare = if (ptype == .lib) try inquirer.forString(stdout, stdin, "package entry point:", gpa, u.detct_mainfile(gpa, u.try_index(string, args, 1, ""), .cwd(), name) catch |err| switch (err) {42 const entry_bare = if (ptype == .lib) try inquirer.forString(stdout, stdin, "package entry point:", gpa, u.detct_mainfile(gpa, u.try_index([:0]const u8, args, 1, ""), .cwd(), name) catch |err| switch (err) {
43 error.CantFindMain => try std.mem.concat(gpa, u8, &.{ flatname, ".zig" }),43 error.CantFindMain => try std.mem.concat(gpa, u8, &.{ flatname, ".zig" }),
44 else => |ee| return ee,44 else => |ee| return ee,
45 }) else null;45 }) else null;
...@@ -138,10 +138,10 @@ pub fn execute(self_name: []const u8, args: [][:0]u8) !void {...@@ -138,10 +138,10 @@ pub fn execute(self_name: []const u8, args: [][:0]u8) !void {
138 }138 }
139139
140 // ask about .gitignore140 // ask about .gitignore
141 if (try extras.doesFolderExist(null, ".git")) {141 if (try nfs.cwd().existsDir(".git")) {
142 const do = try inquirer.forConfirm(stdout, stdin, "It appears you're using git. Do you want init to add Zigmod to your .gitignore?", gpa);142 const do = try inquirer.forConfirm(stdout, stdin, "It appears you're using git. Do you want init to add Zigmod to your .gitignore?", gpa);
143 if (do) {143 if (do) {
144 const exists = try extras.doesFileExist(null, ".gitignore");144 const exists = try nfs.cwd().exists(".gitignore");
145 const file: nfs.File = try (if (exists) cwd.openFile(".gitignore", .{ .mode = .read_write }) else cwd.createFile(".gitignore", .{}));145 const file: nfs.File = try (if (exists) cwd.openFile(".gitignore", .{ .mode = .read_write }) else cwd.createFile(".gitignore", .{}));
146 defer file.close();146 defer file.close();
147 const len = try file.getEndPos();147 const len = try file.getEndPos();
...@@ -160,10 +160,10 @@ pub fn execute(self_name: []const u8, args: [][:0]u8) !void {...@@ -160,10 +160,10 @@ pub fn execute(self_name: []const u8, args: [][:0]u8) !void {
160 }160 }
161161
162 // ask about .gitattributes162 // ask about .gitattributes
163 if (try extras.doesFolderExist(null, ".git")) {163 if (try nfs.cwd().existsDir(".git")) {
164 const do = try inquirer.forConfirm(stdout, stdin, "It appears you're using git. Do you want init to add Zigmod to your .gitattributes?", gpa);164 const do = try inquirer.forConfirm(stdout, stdin, "It appears you're using git. Do you want init to add Zigmod to your .gitattributes?", gpa);
165 if (do) {165 if (do) {
166 const exists = try extras.doesFileExist(null, ".gitattributes");166 const exists = try nfs.cwd().exists(".gitattributes");
167 const file: nfs.File = try (if (exists) cwd.openFile(".gitattributes", .{ .mode = .read_write }) else cwd.createFile(".gitattributes", .{}));167 const file: nfs.File = try (if (exists) cwd.openFile(".gitattributes", .{ .mode = .read_write }) else cwd.createFile(".gitattributes", .{}));
168 defer file.close();168 defer file.close();
169 const len = try file.getEndPos();169 const len = try file.getEndPos();
...@@ -179,7 +179,7 @@ pub fn execute(self_name: []const u8, args: [][:0]u8) !void {...@@ -179,7 +179,7 @@ pub fn execute(self_name: []const u8, args: [][:0]u8) !void {
179 }179 }
180180
181 // ask about build.zig181 // ask about build.zig
182 if (!try extras.doesFileExist(null, "build.zig")) {182 if (!try nfs.cwd().exists("build.zig")) {
183 const do = try inquirer.forConfirm(stdout, stdin, "It looks like there's no build.zig. Do you want Zigmod to generate one for you?", gpa);183 const do = try inquirer.forConfirm(stdout, stdin, "It looks like there's no build.zig. Do you want Zigmod to generate one for you?", gpa);
184 if (do) {184 if (do) {
185 const file = try cwd.createFile("build.zig", .{});185 const file = try cwd.createFile("build.zig", .{});
...@@ -246,7 +246,7 @@ pub fn execute(self_name: []const u8, args: [][:0]u8) !void {...@@ -246,7 +246,7 @@ pub fn execute(self_name: []const u8, args: [][:0]u8) !void {
246 }246 }
247247
248 // ask about main.zig / mod.zig248 // ask about main.zig / mod.zig
249 if (!try extras.doesFileExist(null, entry orelse "main.zig")) {249 if (!try nfs.cwd().exists(entry orelse "main.zig")) {
250 const do = try inquirer.forConfirm(stdout, stdin, "It looks like your entry point doesn't exist. Do you want Zigmod to generate it for you?", gpa);250 const do = try inquirer.forConfirm(stdout, stdin, "It looks like your entry point doesn't exist. Do you want Zigmod to generate it for you?", gpa);
251 if (do) {251 if (do) {
252 const file = try cwd.createFile(entry orelse "main.zig", .{});252 const file = try cwd.createFile(entry orelse "main.zig", .{});
...@@ -280,7 +280,7 @@ pub fn execute(self_name: []const u8, args: [][:0]u8) !void {...@@ -280,7 +280,7 @@ pub fn execute(self_name: []const u8, args: [][:0]u8) !void {
280 }280 }
281281
282 // ask about test.zig282 // ask about test.zig
283 if (!try extras.doesFileExist(null, "test.zig")) {283 if (!try nfs.cwd().exists("test.zig")) {
284 const do = try inquirer.forConfirm(stdout, stdin, "It looks like there's no test.zig. Do you want Zigmod to generate it for you?", gpa);284 const do = try inquirer.forConfirm(stdout, stdin, "It looks like there's no test.zig. Do you want Zigmod to generate it for you?", gpa);
285 if (do) {285 if (do) {
286 const file = try cwd.createFile("test.zig", .{});286 const file = try cwd.createFile("test.zig", .{});
...@@ -342,10 +342,11 @@ pub fn writeLibManifest(w: nfs.File, id: string, name: string, license: string,...@@ -342,10 +342,11 @@ pub fn writeLibManifest(w: nfs.File, id: string, name: string, license: string,
342}342}
343343
344fn guessCopyrightName() !?string {344fn guessCopyrightName() !?string {
345 const home = (try knownfolders.open(gpa, .home, .{})).?;345 const homepath = (try knownfolders.getPath(gpa, .home)).?;
346 if (!(try extras.doesFileExist(home, ".gitconfig"))) return null;346 const home = try nfs.cwd().openDirC(homepath, .{});
347 if (!(try home.exists(".gitconfig"))) return null;
347 const file = try home.openFile(".gitconfig", .{});348 const file = try home.openFile(".gitconfig", .{});
348 const content = try file.reader().readAllAlloc(gpa, 1024 * 1024);349 const content = try file.readAllAlloc(gpa, 1024 * 1024);
349 var iniO = try ini.parseIntoMap(content, gpa);350 var iniO = try ini.parseIntoMap(content, gpa);
350 return iniO.map.get("user.name");351 return iniO.map.get("user.name");
351}352}
src/cmd/install.zig+1-1
...@@ -53,7 +53,7 @@ pub fn execute(self_name: []const u8, args: [][:0]u8) !void {...@@ -53,7 +53,7 @@ pub fn execute(self_name: []const u8, args: [][:0]u8) !void {
53 const modpath = try std.fs.path.joinZ(gpa, &.{ cachepath, clean_path });53 const modpath = try std.fs.path.joinZ(gpa, &.{ cachepath, clean_path });
54 std.log.debug("modpath: {s}", .{modpath});54 std.log.debug("modpath: {s}", .{modpath});
5555
56 if (!try extras.doesFolderExist(null, modpath)) {56 if (!try nfs.cwd().existsDir(modpath)) {
57 try dep.type.pull(gpa, dep.path, modpath);57 try dep.type.pull(gpa, dep.path, modpath);
58 } else {58 } else {
59 try dep.type.update(gpa, modpath, "");59 try dep.type.update(gpa, modpath, "");
src/common.zig+8-8
...@@ -138,7 +138,7 @@ pub fn get_modpath(cachepath: string, d: zigmod.Dep, options: *CollectOptions) !...@@ -138,7 +138,7 @@ pub fn get_modpath(cachepath: string, d: zigmod.Dep, options: *CollectOptions) !
138 u.fail("fetch: git: version type '{s}' is invalid.", .{vtype});138 u.fail("fetch: git: version type '{s}' is invalid.", .{vtype});
139 },139 },
140 };140 };
141 if (try extras.doesFolderExist(null, pv)) {141 if (try nfs.cwd().existsDir(pv)) {
142 if (vers.id == .branch) {142 if (vers.id == .branch) {
143 if (options.update) {143 if (options.update) {
144 try d.type.update(options.alloc, pv, d.path);144 try d.type.update(options.alloc, pv, d.path);
...@@ -160,7 +160,7 @@ pub fn get_modpath(cachepath: string, d: zigmod.Dep, options: *CollectOptions) !...@@ -160,7 +160,7 @@ pub fn get_modpath(cachepath: string, d: zigmod.Dep, options: *CollectOptions) !
160 try setTreeReadOnly(pvd, options.alloc);160 try setTreeReadOnly(pvd, options.alloc);
161 return pv;161 return pv;
162 }162 }
163 if (!try extras.doesFolderExist(null, p)) {163 if (!try nfs.cwd().existsDir(p)) {
164 try d.type.pull(options.alloc, d.path, p);164 try d.type.pull(options.alloc, d.path, p);
165 } else {165 } else {
166 if (options.update) {166 if (options.update) {
...@@ -170,7 +170,7 @@ pub fn get_modpath(cachepath: string, d: zigmod.Dep, options: *CollectOptions) !...@@ -170,7 +170,7 @@ pub fn get_modpath(cachepath: string, d: zigmod.Dep, options: *CollectOptions) !
170 return p;170 return p;
171 },171 },
172 .hg => {172 .hg => {
173 if (!try extras.doesFolderExist(null, p)) {173 if (!try nfs.cwd().existsDir(p)) {
174 try d.type.pull(options.alloc, d.path, p);174 try d.type.pull(options.alloc, d.path, p);
175 } else {175 } else {
176 if (options.update) {176 if (options.update) {
...@@ -180,12 +180,12 @@ pub fn get_modpath(cachepath: string, d: zigmod.Dep, options: *CollectOptions) !...@@ -180,12 +180,12 @@ pub fn get_modpath(cachepath: string, d: zigmod.Dep, options: *CollectOptions) !
180 return p;180 return p;
181 },181 },
182 .http => {182 .http => {
183 if (try extras.doesFolderExist(null, pv)) {183 if (try nfs.cwd().existsDir(pv)) {
184 return pv;184 return pv;
185 }185 }
186 const file_name = u.last(try u.split(options.alloc, d.path, '/')).?;186 const file_name = u.last(try u.split(options.alloc, d.path, '/')).?;
187 if (d.version.len > 0) {187 if (d.version.len > 0) {
188 if (try extras.doesFolderExist(null, pv)) {188 if (try nfs.cwd().existsDir(pv)) {
189 return pv;189 return pv;
190 }190 }
191 const file_path = try std.fs.path.joinZ(options.alloc, &.{ pv, file_name });191 const file_path = try std.fs.path.joinZ(options.alloc, &.{ pv, file_name });
...@@ -201,7 +201,7 @@ pub fn get_modpath(cachepath: string, d: zigmod.Dep, options: *CollectOptions) !...@@ -201,7 +201,7 @@ pub fn get_modpath(cachepath: string, d: zigmod.Dep, options: *CollectOptions) !
201 u.fail("{s} does not match hash {s}", .{ d.path, d.version });201 u.fail("{s} does not match hash {s}", .{ d.path, d.version });
202 return p;202 return p;
203 }203 }
204 if (try extras.doesFolderExist(null, p)) {204 if (try nfs.cwd().existsDir(p)) {
205 try nfs.cwd().deleteTree(p);205 try nfs.cwd().deleteTree(p);
206 }206 }
207 const file_path_s = try std.fs.path.resolve(options.alloc, &.{ p, file_name });207 const file_path_s = try std.fs.path.resolve(options.alloc, &.{ p, file_name });
...@@ -263,7 +263,7 @@ pub fn get_module_from_dep(d: *zigmod.Dep, cachepath: [:0]const u8, options: *Co...@@ -263,7 +263,7 @@ pub fn get_module_from_dep(d: *zigmod.Dep, cachepath: [:0]const u8, options: *Co
263 }263 }
264 const moddirO = try nfs.cwd().openDir(modpath, .{});264 const moddirO = try nfs.cwd().openDir(modpath, .{});
265 const tryname = try u.detect_pkgname(options.alloc, d.name, modpath);265 const tryname = try u.detect_pkgname(options.alloc, d.name, modpath);
266 const trymain: ?string = u.detct_mainfile(options.alloc, d.main, moddirO, tryname) catch |err| switch (err) {266 const trymain = u.detct_mainfile(options.alloc, d.main, moddirO, tryname) catch |err| switch (err) {
267 error.CantFindMain => null,267 error.CantFindMain => null,
268 else => |ee| return ee,268 else => |ee| return ee,
269 };269 };
...@@ -335,7 +335,7 @@ pub fn gen_files_package(alloc: std.mem.Allocator, cachepath: string, mdir: nfs....@@ -335,7 +335,7 @@ pub fn gen_files_package(alloc: std.mem.Allocator, cachepath: string, mdir: nfs.
335pub fn parse_lockfile(alloc: std.mem.Allocator, dir: nfs.Dir) ![]const [4]string {335pub fn parse_lockfile(alloc: std.mem.Allocator, dir: nfs.Dir) ![]const [4]string {
336 var list = std.ArrayList([4]string).init(alloc);336 var list = std.ArrayList([4]string).init(alloc);
337 const max = std.math.maxInt(usize);337 const max = std.math.maxInt(usize);
338 if (!try extras.doesFileExist(dir.to_std(), "zigmod.lock")) return &[_][4]string{};338 if (!try dir.exists("zigmod.lock")) return &[_][4]string{};
339 var f = try dir.openFile("zigmod.lock", .{});339 var f = try dir.openFile("zigmod.lock", .{});
340 defer f.close();340 defer f.close();
341 var r = nio.BufferedReader(4096, nfs.File).init(f);341 var r = nio.BufferedReader(4096, nfs.File).init(f);
src/util/dep.zig+1-1
...@@ -17,7 +17,7 @@ pub const Dep = struct {...@@ -17,7 +17,7 @@ pub const Dep = struct {
17 path: [:0]const u8,17 path: [:0]const u8,
18 id: [48]u8,18 id: [48]u8,
19 name: string,19 name: string,
20 main: string,20 main: [:0]const u8,
21 version: string,21 version: string,
22 c_include_dirs: []const string = &.{},22 c_include_dirs: []const string = &.{},
23 c_source_flags: []const string = &.{},23 c_source_flags: []const string = &.{},
src/util/funcs.zig+19-10
...@@ -44,10 +44,19 @@ pub fn split(alloc: std.mem.Allocator, in: string, delim: u8) ![]string {...@@ -44,10 +44,19 @@ pub fn split(alloc: std.mem.Allocator, in: string, delim: u8) ![]string {
44 return list.toOwnedSlice();44 return list.toOwnedSlice();
45}45}
4646
47pub fn file_list(alloc: std.mem.Allocator, dpath: [:0]const u8) ![]const string {47pub fn file_list(alloc: std.mem.Allocator, dpath: [:0]const u8) ![][:0]u8 {
48 var dir = try nfs.cwd().openDir(dpath, .{});48 var dir = try nfs.cwd().openDir(dpath, .{});
49 defer dir.close();49 defer dir.close();
50 return try extras.fileList(alloc, dir.to_std());50 var list = std.ArrayList([:0]u8).init(alloc);
51 errdefer list.deinit();
52 errdefer for (list.items) |x| alloc.free(x);
53 var walker = try dir.walk(alloc);
54 defer walker.deinit();
55 while (try walker.next()) |entry| {
56 if (entry.type != .REG) continue;
57 try list.append(try alloc.dupeZ(u8, entry.path));
58 }
59 return list.toOwnedSlice();
51}60}
5261
53pub fn run_cmd_raw(alloc: std.mem.Allocator, dir: ?string, args: []const string) !std.process.Child.RunResult {62pub fn run_cmd_raw(alloc: std.mem.Allocator, dir: ?string, args: []const string) !std.process.Child.RunResult {
...@@ -168,28 +177,28 @@ pub fn detect_pkgname(alloc: std.mem.Allocator, override: string, dir: [:0]const...@@ -168,28 +177,28 @@ pub fn detect_pkgname(alloc: std.mem.Allocator, override: string, dir: [:0]const
168 return name;177 return name;
169}178}
170179
171pub fn detct_mainfile(alloc: std.mem.Allocator, override: string, dir: nfs.Dir, name: string) !string {180pub fn detct_mainfile(alloc: std.mem.Allocator, override: [:0]const u8, dir: nfs.Dir, name: string) ![:0]const u8 {
172 if (override.len > 0) {181 if (override.len > 0) {
173 if (try extras.doesFileExist(dir.to_std(), override)) {182 if (try dir.exists(override)) {
174 if (std.mem.endsWith(u8, override, ".zig")) {183 if (std.mem.endsWith(u8, override, ".zig")) {
175 return override;184 return override;
176 }185 }
177 }186 }
178 }187 }
179 const namedotzig = try std.mem.concat(alloc, u8, &.{ name, ".zig" });188 const namedotzig = try std.mem.concatWithSentinel(alloc, u8, &.{ name, ".zig" }, 0);
180 if (try extras.doesFileExist(dir.to_std(), namedotzig)) {189 if (try dir.exists(namedotzig)) {
181 return namedotzig;190 return namedotzig;
182 }191 }
183 if (try extras.doesFileExist(dir.to_std(), "lib.zig")) {192 if (try dir.exists("lib.zig")) {
184 return "lib.zig";193 return "lib.zig";
185 }194 }
186 if (try extras.doesFileExist(dir.to_std(), "main.zig")) {195 if (try dir.exists("main.zig")) {
187 return "main.zig";196 return "main.zig";
188 }197 }
189 if (try extras.doesFileExist(dir.to_std(), try std.fs.path.join(alloc, &.{ "src", "lib.zig" }))) {198 if (try dir.exists(try std.fs.path.joinZ(alloc, &.{ "src", "lib.zig" }))) {
190 return "src/lib.zig";199 return "src/lib.zig";
191 }200 }
192 if (try extras.doesFileExist(dir.to_std(), try std.fs.path.join(alloc, &.{ "src", "main.zig" }))) {201 if (try dir.exists(try std.fs.path.joinZ(alloc, &.{ "src", "main.zig" }))) {
193 return "src/main.zig";202 return "src/main.zig";
194 }203 }
195 return error.CantFindMain;204 return error.CantFindMain;
src/util/modfile.zig+2-2
...@@ -104,7 +104,7 @@ pub const ModFile = struct {...@@ -104,7 +104,7 @@ pub const ModFile = struct {
104 for (dep_seq.sequence) |item| {104 for (dep_seq.sequence) |item| {
105 var dtype: string = undefined;105 var dtype: string = undefined;
106 var path: [:0]const u8 = undefined;106 var path: [:0]const u8 = undefined;
107 var version: ?string = null;107 var version: ?[:0]const u8 = null;
108 var main = item.mapping.get_string("main") orelse "";108 var main = item.mapping.get_string("main") orelse "";
109109
110 if (item.mapping.get("src")) |val| {110 if (item.mapping.get("src")) |val| {
...@@ -112,7 +112,7 @@ pub const ModFile = struct {...@@ -112,7 +112,7 @@ pub const ModFile = struct {
112 dtype = src_iter.next().?;112 dtype = src_iter.next().?;
113 path = try gpa.dupeZ(u8, src_iter.next().?);113 path = try gpa.dupeZ(u8, src_iter.next().?);
114 if (src_iter.next()) |dver| {114 if (src_iter.next()) |dver| {
115 version = dver;115 version = try gpa.dupeZ(u8, dver);
116 }116 }
117 } else {117 } else {
118 dtype = item.mapping.get("type").?.string;118 dtype = item.mapping.get("type").?.string;
zigmod.lock+4-4
...@@ -3,7 +3,7 @@ git https://github.com/marlersoft/zigwin32 commit-ec98bb4d9eea532320a8551720a9e3...@@ -3,7 +3,7 @@ git https://github.com/marlersoft/zigwin32 commit-ec98bb4d9eea532320a8551720a9e3
3git https://github.com/nektro/arqv-ini commit-ab427a4de4f875eaa39ee56a29114fc0204315463git https://github.com/nektro/arqv-ini commit-ab427a4de4f875eaa39ee56a29114fc020431546
4git https://github.com/nektro/zig-ansi commit-5f89211a749aef6bf518889c0467ceb24825c0554git https://github.com/nektro/zig-ansi commit-5f89211a749aef6bf518889c0467ceb24825c055
5git https://github.com/nektro/zig-detect-license commit-a1a066da88dab50873a56f0349dc12dc765420775git https://github.com/nektro/zig-detect-license commit-a1a066da88dab50873a56f0349dc12dc76542077
6git https://github.com/nektro/zig-extras commit-b3457b31a1d1ea2c19c5d0b007c903d3e80add406git https://github.com/nektro/zig-extras commit-0cf756c80a4bc1b0459bc81bf8071891f12c3738
7git https://github.com/nektro/zig-git commit-2b3f83cd341764f979969603e4f77e62f353b6a37git https://github.com/nektro/zig-git commit-2b3f83cd341764f979969603e4f77e62f353b6a3
8git https://github.com/nektro/zig-inquirer commit-4cddefa42744d61067567b0b36b5d2bb376e5ae38git https://github.com/nektro/zig-inquirer commit-4cddefa42744d61067567b0b36b5d2bb376e5ae3
9git https://github.com/nektro/zig-intrusive-parser commit-a31b480914d15f3d13cdfb586aac950c73beebdd9git https://github.com/nektro/zig-intrusive-parser commit-a31b480914d15f3d13cdfb586aac950c73beebdd
...@@ -11,13 +11,13 @@ git https://github.com/nektro/zig-json commit-428aa8a29e370fdb2e6739d5676b1de415...@@ -11,13 +11,13 @@ git https://github.com/nektro/zig-json commit-428aa8a29e370fdb2e6739d5676b1de415
11git https://github.com/nektro/zig-leven commit-618eddde4ffbc6d34100e4bc6aa654d41161537a11git https://github.com/nektro/zig-leven commit-618eddde4ffbc6d34100e4bc6aa654d41161537a
12git https://github.com/nektro/zig-licenses commit-16cef5e32b3f8bbcf1064c599615290a720b654712git https://github.com/nektro/zig-licenses commit-16cef5e32b3f8bbcf1064c599615290a720b6547
13git https://github.com/nektro/zig-licenses-text commit-ba0f00dfb23d28c301e4b54d0a278def2c38dc7b13git https://github.com/nektro/zig-licenses-text commit-ba0f00dfb23d28c301e4b54d0a278def2c38dc7b
14git https://github.com/nektro/zig-nfs commit-c855473c8bd15dd24a4e8b6911b7e006062004ba14git https://github.com/nektro/zig-nfs commit-c61b820567505899198bb425c2b7c459a1f3cce2
15git https://github.com/nektro/zig-nio commit-c1da2e8a31858880eb3e4cfcf12de0a86561762315git https://github.com/nektro/zig-nio commit-c1da2e8a31858880eb3e4cfcf12de0a865617623
16git https://github.com/nektro/zig-sys-darwin commit-3265d1f06418eb0360d753c12116310a14b97bde16git https://github.com/nektro/zig-sys-darwin commit-c8ef1a85dfb5e1891454650f88d56bfaa0834304
17git https://github.com/nektro/zig-sys-linux commit-f0b155d3627f8c19868be1b2f15d71cda908b57517git https://github.com/nektro/zig-sys-linux commit-f0b155d3627f8c19868be1b2f15d71cda908b575
18git https://github.com/nektro/zig-time commit-0f4db4c980146e4a3fc86a9a9070452a25ff931718git https://github.com/nektro/zig-time commit-0f4db4c980146e4a3fc86a9a9070452a25ff9317
19git https://github.com/nektro/zig-tracer commit-3a5fdea4ffd387a53ac2a42fb503557cdbe2069619git https://github.com/nektro/zig-tracer commit-3a5fdea4ffd387a53ac2a42fb503557cdbe20696
20git https://github.com/nektro/zig-yaml commit-00e899bec815bc2b49c6e5a72a7cfeeda673e13320git https://github.com/nektro/zig-yaml commit-1dbb8eec4059e6b49e9a590300355f8090c681c7
21git https://github.com/madler/zlib tag-v1.3.221git https://github.com/madler/zlib tag-v1.3.2
22git https://github.com/yaml/libyaml tag-0.2.522git https://github.com/yaml/libyaml tag-0.2.5
23git https://github.com/ziglibs/known-folders commit-aa24df42183ad415d10bc0a33e6238c437fc0f5923git https://github.com/ziglibs/known-folders commit-aa24df42183ad415d10bc0a33e6238c437fc0f59