Fix rebar dialyzer to work on applications in rebar archive

`code:lib_dir/1,2` picks up the application directory from the rebar archive. In these cases search the code path for the project's version instead. This should allow reverting https://github.com/rebar/rebar3/commit/08698c9403f2dee266ff5d4910a7ee92869b55cd.

Second commit fixes a bug when `~` appears in dialyzer warnings causing printing to crash. (A warning including atom `'~>'` appears when dialyzing `rebar3` itself).

Note that running `rebar3 dialyzer` on `rebar3` requires OTP `17.2.2` or early due to `warnings_as_errors` bug in dialyzer (fixed in https://github.com/erlang/otp/commit/9990e4a86be55436fa153284a2791abd7f642a30).