| ... | @@ -76,23 +76,9 @@ pub fn list_contains_gen(comptime T: type, haystack: []const T, needle: T) bool | ... | @@ -76,23 +76,9 @@ pub fn list_contains_gen(comptime T: type, haystack: []const T, needle: T) bool |
| 76 | } | 76 | } |
| 77 | | 77 | |
| 78 | pub fn file_list(alloc: std.mem.Allocator, dpath: string) ![]const string { | 78 | pub fn file_list(alloc: std.mem.Allocator, dpath: string) ![]const string { |
| 79 | var list = std.ArrayList(string).init(alloc); | 79 | var dir = try std.fs.cwd().openIterableDir(dpath, .{}); |
| 80 | defer list.deinit(); | 80 | defer dir.close(); |
| 81 | | 81 | return try extras.fileList(alloc, dir); |
| 82 | const dir = try std.fs.cwd().openIterableDir(dpath, .{}); | | |
| 83 | var walk = try dir.walk(alloc); | | |
| 84 | defer walk.deinit(); | | |
| 85 | while (true) { | | |
| 86 | if (try walk.next()) |entry| { | | |
| 87 | if (entry.kind != .File) { | | |
| 88 | continue; | | |
| 89 | } | | |
| 90 | try list.append(try alloc.dupe(u8, entry.path)); | | |
| 91 | } else { | | |
| 92 | break; | | |
| 93 | } | | |
| 94 | } | | |
| 95 | return list.toOwnedSlice(); | | |
| 96 | } | 82 | } |
| 97 | | 83 | |
| 98 | pub fn run_cmd_raw(alloc: std.mem.Allocator, dir: ?string, args: []const string) !std.ChildProcess.ExecResult { | 84 | pub fn run_cmd_raw(alloc: std.mem.Allocator, dir: ?string, args: []const string) !std.ChildProcess.ExecResult { |