From c32d26f509bbf37bc2a0341992896a7b8f6a7887 Mon Sep 17 00:00:00 2001 From: Dave Smith Date: Tue, 22 Jun 2010 10:25:42 -0600 Subject: [PATCH] Enable target_dir to be passed as command-line parameter --- src/rebar_reltool.erl | 25 +++++++++++++++---------- 1 file 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. %%