aboutsummaryrefslogtreecommitdiff
path: root/src/storage/user.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/storage/user.zig')
-rw-r--r--src/storage/user.zig18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/storage/user.zig b/src/storage/user.zig
index b817f84..c2cc82a 100644
--- a/src/storage/user.zig
+++ b/src/storage/user.zig
@@ -214,3 +214,21 @@ pub fn set_image(
try file_writer.interface.flush();
}
+
+pub fn list(
+ storage: *Storage,
+ allocator: std.mem.Allocator,
+) ![][]const u8 {
+ var user = try storage.dir.openDir("user", .{ .iterate = true });
+ defer user.close();
+
+ var ids: std.ArrayList([]const u8) = .empty;
+
+ var iterator = user.iterate();
+
+ while (try iterator.next()) |entry| {
+ try ids.append(allocator, try allocator.dupe(u8, entry.name));
+ }
+
+ return ids.toOwnedSlice(allocator);
+}