diff options
author | Eric <[email protected]> | 2012-10-26 17:23:40 -0500 |
---|---|---|
committer | Jordan Wilberding <[email protected]> | 2012-10-30 09:54:42 -0600 |
commit | 770cf1d0229f895f45e709375aa09c0568c32dfa (patch) | |
tree | ed53c56aed426c98eeed8589bdc312a428afdfc5 /src/rcl_state.erl | |
parent | d418f238a12d5e89223400bdfed844c673c3f12f (diff) | |
download | relx-770cf1d0229f895f45e709375aa09c0568c32dfa.tar.gz relx-770cf1d0229f895f45e709375aa09c0568c32dfa.tar.bz2 relx-770cf1d0229f895f45e709375aa09c0568c32dfa.zip |
fix config file processing in relcool
If only a single config is passed as part of the api then that
was mishandled. This patch allows that situation to be detected
and properly handled
Signed-off-by: Jordan Wilberding <[email protected]>
Diffstat (limited to 'src/rcl_state.erl')
-rw-r--r-- | src/rcl_state.erl | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/rcl_state.erl b/src/rcl_state.erl index c326df1..46c91c7 100644 --- a/src/rcl_state.erl +++ b/src/rcl_state.erl @@ -85,13 +85,13 @@ %% API %%============================================================================ %% @doc Create a new 'log level' for the system --spec new(proplists:proplist(), [file:filename()]) -> t(). +-spec new(proplists:proplist(), [file:filename()] | file:filename()) -> t(). new(PropList, Targets) when erlang:is_list(PropList) -> State0 = #state_t{log = proplists:get_value(log, PropList, rcl_log:new(error)), output_dir=filename:absname(proplists:get_value(output_dir, PropList, "")), lib_dirs=get_lib_dirs(proplists:get_value(lib_dirs, PropList, [])), - config_files=handle_configs(Targets), + config_files=process_config_files(Targets), goals=proplists:get_value(goals, PropList, []), providers = [], releases=ec_dictionary:new(ec_dict), @@ -253,15 +253,15 @@ create_logic_providers(State0) -> ReleaseProvider, AssemblerProvider]}. -%% @doc explicitly handle single config file path --spec handle_configs(string() | [string()]) -> [string()]. -handle_configs(Configs = [Config | _]) - when erlang:is_list(Config) -> - Configs; -handle_configs(Config = [Char | _]) +%% @doc config files can come in as either a single file name or as a list of +%% files. We what to support both where possible. +process_config_files(File = [Char | _]) when erlang:is_integer(Char) -> - [Config]; -handle_configs([]) -> + [File]; +process_config_files(Files = [File | _]) + when erlang:is_list(File) -> + Files; +process_config_files([]) -> []. %%%=================================================================== |