summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFrancisco Rojas <frojas@alumnos.utalca.cl>2016-03-15 21:51:39 -0700
committerFrancisco Rojas <frojas@groupon.com>2016-03-15 22:03:53 -0700
commit6c9bc2c1d5e7041f7e81cc470b6de78220ea9eb1 (patch)
tree9737877e7155223e4efd1080261d466b8f06759f /src
parent7d29b74a221ef082e4bbee496019c8f1612e8f0b (diff)
Allows overwrite default cache dir using REBAR_CACHE_DIR
Allows overwrite the default cache directory using the environment variable REBAR_CACHE_DIR.
Diffstat (limited to 'src')
-rw-r--r--src/rebar_dir.erl10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/rebar_dir.erl b/src/rebar_dir.erl
index 3729704..840d1f9 100644
--- a/src/rebar_dir.erl
+++ b/src/rebar_dir.erl
@@ -93,8 +93,14 @@ global_config() ->
filename:join([Home, ".config", "rebar3", "rebar.config"]).
global_cache_dir(Opts) ->
- Home = home_dir(),
- rebar_opts:get(Opts, global_rebar_dir, filename:join([Home, ".cache", "rebar3"])).
+ RebarCacheDir = case os:getenv("REBAR_CACHE_DIR") of
+ false ->
+ Home = home_dir(),
+ filename:join([Home, ".cache", "rebar3"]);
+ ConfigFile ->
+ ConfigFile
+ end,
+ rebar_opts:get(Opts, global_rebar_dir, RebarCacheDir).
local_cache_dir(Dir) ->
filename:join(Dir, ".rebar3").