aboutsummaryrefslogtreecommitdiffstats
path: root/src/rcl_prv_config.erl
diff options
context:
space:
mode:
authorTristan Sloughter <[email protected]>2013-01-05 11:09:18 -0800
committerTristan Sloughter <[email protected]>2013-01-05 11:09:18 -0800
commit1a43e62a5ee0ceafb2082a41e632489b48e7f567 (patch)
tree106c5822d41a2410830b4049993e1a9792e70900 /src/rcl_prv_config.erl
parented855acb2246aaa05d2fab628e1e09d1082b06a8 (diff)
parentf1632c3282d719cd5cbb46299f4f0557653ba50f (diff)
downloadrelx-1a43e62a5ee0ceafb2082a41e632489b48e7f567.tar.gz
relx-1a43e62a5ee0ceafb2082a41e632489b48e7f567.tar.bz2
relx-1a43e62a5ee0ceafb2082a41e632489b48e7f567.zip
Merge pull request #20 from ericbmerritt/next
overlay directory support
Diffstat (limited to 'src/rcl_prv_config.erl')
-rw-r--r--src/rcl_prv_config.erl14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/rcl_prv_config.erl b/src/rcl_prv_config.erl
index 7ea9a77..f87c467 100644
--- a/src/rcl_prv_config.erl
+++ b/src/rcl_prv_config.erl
@@ -29,11 +29,11 @@ init(State) ->
%% populating the state as a result.
-spec do(rcl_state:t()) ->{ok, rcl_state:t()} | relcool:error().
do(State) ->
- case rcl_state:config_files(State) of
+ case rcl_state:config_file(State) of
[] ->
search_for_dominating_config(State);
- ConfigFiles ->
- lists:foldl(fun load_config/2, {ok, State}, ConfigFiles)
+ ConfigFile ->
+ load_config(ConfigFile, State)
end.
-spec format_error(Reason::term()) -> iolist().
@@ -63,7 +63,7 @@ search_for_dominating_config(State0) ->
%% we need to set the root dir on state as well
{ok, RootDir} = parent_dir(Config),
State1 = rcl_state:root_dir(State0, RootDir),
- load_config(Config, {ok, rcl_state:config_files(State1, [Config])});
+ load_config(Config, rcl_state:config_file(State1, Config));
no_config ->
{ok, State0}
end.
@@ -88,11 +88,9 @@ parent_dir([H | T], Acc) ->
parent_dir(T, [H | Acc]).
--spec load_config(file:filename(), {ok, rcl_state:t()} | relcool:error()) ->
+-spec load_config(file:filename(), rcl_state:t()) ->
{ok, rcl_state:t()} | relcool:error().
-load_config(_, Err = {error, _}) ->
- Err;
-load_config(ConfigFile, {ok, State}) ->
+load_config(ConfigFile, State) ->
{ok, CurrentCwd} = file:get_cwd(),
ok = file:set_cwd(filename:dirname(ConfigFile)),
Result = case file:consult(ConfigFile) of