summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Smith <dizzyd@dizzyd.com>2010-06-22 10:25:42 -0600
committerDave Smith <dizzyd@dizzyd.com>2010-06-22 10:25:42 -0600
commitc32d26f509bbf37bc2a0341992896a7b8f6a7887 (patch)
tree7094678525ab6642d5606aa7c581c6568c45972e
parent127483f32b0e6f0b7ae8901aa4f215cd070e1763 (diff)
Enable target_dir to be passed as command-line parameter
-rw-r--r--src/rebar_reltool.erl25
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.
%%