feat: add FLOW_CONFIG_DIR env var to override configuration directory

closes #379
This commit is contained in:
CJ van den Berg 2025-11-16 18:45:57 +01:00
parent e2955f029d
commit e9d336e336
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9

View file

@ -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: {