Add caching of app file

This commit is contained in:
Dave Smith 2010-04-28 13:02:51 -06:00
parent f81cf34bb9
commit c28a16258c

View file

@ -85,11 +85,17 @@ app_vsn(AppFile) ->
%% =================================================================== %% ===================================================================
load_app_file(Filename) -> load_app_file(Filename) ->
case erlang:get({app_file, Filename}) of
undefined ->
case file:consult(Filename) of case file:consult(Filename) of
{ok, [{application, AppName, AppData}]} -> {ok, [{application, AppName, AppData}]} ->
erlang:put({app_file, Filename}, {AppName, AppData}),
{ok, AppName, AppData}; {ok, AppName, AppData};
{error, Reason} -> {error, Reason} ->
{error, Reason}; {error, Reason};
Other -> Other ->
{error, {unexpected_terms, Other}} {error, {unexpected_terms, Other}}
end;
{AppName, AppData} ->
{ok, AppName, AppData}
end. end.