From e9d336e3363c315dfff7fda279e5071df6920d7d Mon Sep 17 00:00:00 2001 From: CJ van den Berg Date: Sun, 16 Nov 2025 18:45:57 +0100 Subject: [PATCH] feat: add FLOW_CONFIG_DIR env var to override configuration directory closes #379 --- src/main.zig | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main.zig b/src/main.zig index 7b19189..763bd8d 100644 --- a/src/main.zig +++ b/src/main.zig @@ -854,7 +854,10 @@ fn get_app_config_dir(appname: []const u8) ConfigDirError![]const u8 { }; const config_dir = if (local.config_dir) |dir| dir - else if (std.process.getEnvVarOwned(a, "XDG_CONFIG_HOME") catch null) |xdg| ret: { + else if (std.process.getEnvVarOwned(a, "FLOW_CONFIG_DIR") catch null) |dir| ret: { + defer a.free(dir); + break :ret try std.fmt.bufPrint(&local.config_dir_buffer, "{s}", .{dir}); + } else if (std.process.getEnvVarOwned(a, "XDG_CONFIG_HOME") catch null) |xdg| ret: { defer a.free(xdg); break :ret try std.fmt.bufPrint(&local.config_dir_buffer, "{s}{c}{s}", .{ xdg, sep, appname }); } else if (std.process.getEnvVarOwned(a, "HOME") catch null) |home| ret: {