diff options
Diffstat (limited to 'src/rebar_app_utils.erl')
-rw-r--r-- | src/rebar_app_utils.erl | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/src/rebar_app_utils.erl b/src/rebar_app_utils.erl index 24c8e1b..900fff0 100644 --- a/src/rebar_app_utils.erl +++ b/src/rebar_app_utils.erl @@ -24,7 +24,14 @@ %% ------------------------------------------------------------------- -module(rebar_app_utils). --export([is_app_dir/0, is_app_dir/1]). +-export([is_app_dir/0, is_app_dir/1, + load_app_file/1]). + +-include("rebar.hrl"). + +%% =================================================================== +%% Public API +%% =================================================================== is_app_dir() -> is_app_dir(rebar_util:get_cwd()). @@ -37,3 +44,15 @@ is_app_dir(Dir) -> _ -> false end. + +load_app_file(Filename) -> + case file:consult(Filename) of + {ok, [{application, AppName, AppData}]} -> + {ok, AppName, AppData}; + {error, Reason} -> + ?ERROR("Failed to load app file from ~s: ~p\n", [Filename, Reason]), + error; + Other -> + ?ERROR("Unexpected terms from app file ~s: ~p\n", [Filename, Other]), + error + end. |