mirror of
https://github.com/correl/rebar.git
synced 2024-12-18 03:00:17 +00:00
Add caching of app file
This commit is contained in:
parent
f81cf34bb9
commit
c28a16258c
1 changed files with 13 additions and 7 deletions
|
@ -85,11 +85,17 @@ app_vsn(AppFile) ->
|
|||
%% ===================================================================
|
||||
|
||||
load_app_file(Filename) ->
|
||||
case file:consult(Filename) of
|
||||
{ok, [{application, AppName, AppData}]} ->
|
||||
{ok, AppName, AppData};
|
||||
{error, Reason} ->
|
||||
{error, Reason};
|
||||
Other ->
|
||||
{error, {unexpected_terms, Other}}
|
||||
case erlang:get({app_file, Filename}) of
|
||||
undefined ->
|
||||
case file:consult(Filename) of
|
||||
{ok, [{application, AppName, AppData}]} ->
|
||||
erlang:put({app_file, Filename}, {AppName, AppData}),
|
||||
{ok, AppName, AppData};
|
||||
{error, Reason} ->
|
||||
{error, Reason};
|
||||
Other ->
|
||||
{error, {unexpected_terms, Other}}
|
||||
end;
|
||||
{AppName, AppData} ->
|
||||
{ok, AppName, AppData}
|
||||
end.
|
||||
|
|
Loading…
Reference in a new issue