feat: support adding entirely new themes via the config
This commit is contained in:
parent
d53d155c6d
commit
310221bb26
5 changed files with 126 additions and 71 deletions
|
|
@ -895,15 +895,15 @@ pub fn write_theme(theme_name: []const u8, content: []const u8) !void {
|
|||
pub fn list_themes(allocator: std.mem.Allocator) ![]const []const u8 {
|
||||
var dir = try std.fs.openDirAbsolute(try get_theme_directory(), .{ .iterate = true });
|
||||
defer dir.close();
|
||||
var result = std.ArrayList([]const u8).init(allocator);
|
||||
var result: std.ArrayList([]const u8) = .empty;
|
||||
var iter = dir.iterateAssumeFirstIteration();
|
||||
while (try iter.next()) |entry| {
|
||||
switch (entry.kind) {
|
||||
.file, .sym_link => try result.append(try allocator.dupe(u8, std.fs.path.stem(entry.name))),
|
||||
.file, .sym_link => try result.append(allocator, try allocator.dupe(u8, std.fs.path.stem(entry.name))),
|
||||
else => continue,
|
||||
}
|
||||
}
|
||||
return result.toOwnedSlice();
|
||||
return result.toOwnedSlice(allocator);
|
||||
}
|
||||
|
||||
pub fn get_config_dir() ConfigDirError![]const u8 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue