diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/rebar_prv_dialyzer.erl | 33 |
1 files changed, 28 insertions, 5 deletions
diff --git a/src/rebar_prv_dialyzer.erl b/src/rebar_prv_dialyzer.erl index 61b25e1..0ede475 100644 --- a/src/rebar_prv_dialyzer.erl +++ b/src/rebar_prv_dialyzer.erl @@ -160,16 +160,39 @@ app_member(AppName, Apps) -> end. app_name_to_info(AppName) -> - case code:lib_dir(AppName) of + case app_name_to_ebin(AppName) of {error, _} -> ?CONSOLE("Unknown application ~s", [AppName]), {[], []}; - AppDir -> - app_dir_to_info(AppDir, AppName) + EbinDir -> + ebin_to_info(EbinDir, AppName) end. -app_dir_to_info(AppDir, AppName) -> - EbinDir = filename:join(AppDir, "ebin"), +app_name_to_ebin(AppName) -> + case code:lib_dir(AppName, ebin) of + {error, bad_name} -> + search_ebin(AppName); + EbinDir -> + check_ebin(EbinDir, AppName) + end. + +check_ebin(EbinDir, AppName) -> + case filelib:is_dir(EbinDir) of + true -> + EbinDir; + false -> + search_ebin(AppName) + end. + +search_ebin(AppName) -> + case code:where_is_file(atom_to_list(AppName) ++ ".app") of + non_existing -> + {error, bad_name}; + AppFile -> + filename:dirname(AppFile) + end. + +ebin_to_info(EbinDir, AppName) -> AppFile = filename:join(EbinDir, atom_to_list(AppName) ++ ".app"), case file:consult(AppFile) of {ok, [{application, AppName, AppDetails}]} -> |