| ... | ... | @@ -109,3 +109,18 @@ pub fn FieldType(comptime T: type, comptime field: std.meta.FieldEnum(T)) type { |
| 109 | 109 | } |
| 110 | 110 | unreachable; |
| 111 | 111 | } |
| 112 | |
| 113 | pub fn fileList(alloc: *std.mem.Allocator, dir: std.fs.Dir) ![]string { |
| 114 | var list = std.ArrayList(string).init(alloc); |
| 115 | defer list.deinit(); |
| 116 | |
| 117 | var walk = try dir.walk(alloc); |
| 118 | defer walk.deinit(); |
| 119 | while (try walk.next()) |entry| { |
| 120 | if (entry.kind != .File) { |
| 121 | continue; |
| 122 | } |
| 123 | try list.append(try alloc.dupe(u8, entry.path)); |
| 124 | } |
| 125 | return list.toOwnedSlice(); |
| 126 | } |