From 4fdf2fe089cc9d48c462179898fde20ba2217ceb Mon Sep 17 00:00:00 2001 From: Bryan Paxton Date: Mon, 22 Apr 2019 21:11:51 -0500 Subject: Support rebar config dir env var --- src/rebar_dir.erl | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/rebar_dir.erl b/src/rebar_dir.erl index 17bc48e..aac6210 100644 --- a/src/rebar_dir.erl +++ b/src/rebar_dir.erl @@ -107,8 +107,15 @@ home_dir() -> %% may be stored. -spec global_config_dir(rebar_state:t()) -> file:filename_all(). global_config_dir(State) -> - Home = home_dir(), - rebar_state:get(State, global_rebar_dir, filename:join([Home, ".config", "rebar3"])). + filename:join([rebar_config_dir(State), ".config", "rebar3"]). + +rebar_config_dir(State) -> + case os:getenv("REBAR_GLOBAL_CONFIG_DIR") of + false -> + rebar_state:get(State, global_rebar_dir, home_dir()); + ConfDir -> + ConfDir + end. %% @doc returns the path of the global rebar.config file -spec global_config(rebar_state:t()) -> file:filename_all(). -- cgit v1.1