diff options
-rw-r--r-- | src/rebar_reltool.erl | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/src/rebar_reltool.erl b/src/rebar_reltool.erl index 0f99009..f427831 100644 --- a/src/rebar_reltool.erl +++ b/src/rebar_reltool.erl @@ -100,17 +100,22 @@ sys_tuple(ReltoolConfig) -> %% found, use the name of the release as the default target directory. %% target_dir(ReltoolConfig) -> - case lists:keysearch(target_dir, 1, ReltoolConfig) of - {value, {target_dir, TargetDir}} -> - filename:absname(TargetDir); - false -> - {sys, SysInfo} = sys_tuple(ReltoolConfig), - case lists:keysearch(rel, 1, SysInfo) of - {value, {rel, Name, _Vsn, _Apps}} -> - filename:absname(Name); + case rebar_config:get_global(target_dir, undefined) of + undefined -> + case lists:keysearch(target_dir, 1, ReltoolConfig) of + {value, {target_dir, TargetDir}} -> + filename:absname(TargetDir); false -> - filename:absname("target") - end + {sys, SysInfo} = sys_tuple(ReltoolConfig), + case lists:keysearch(rel, 1, SysInfo) of + {value, {rel, Name, _Vsn, _Apps}} -> + filename:absname(Name); + false -> + filename:absname("target") + end + end; + TargetDir -> + filename:absname(TargetDir) end. %% |