feat(config): write config.toml to config dir, not data dir

This commit is contained in:
2022-11-03 09:45:57 -03:00
parent ef39d9a7b8
commit 429676ad43
2 changed files with 33 additions and 18 deletions

View File

@@ -49,11 +49,11 @@ pub fn config() *const Config {
}
/// Reads a config file and then loads it into the global state
pub fn load(allocator: Allocator, config_path: []const u8) !void {
var config_file = try std.fs.cwd().openFile(config_path, .{});
pub fn load(allocator: Allocator, file_path: []const u8) !void {
var config_file = try std.fs.cwd().openFile(file_path, .{});
defer config_file.close();
log.info("loaded from {s}", .{config_path});
log.info("loaded from {s}", .{file_path});
const contents = try config_file.readToEndAlloc(allocator, try config_file.getEndPos());
defer allocator.free(contents);