<div class="gmail_quote">On 2 December 2011 22:36, Jon Watte <span dir="ltr"><<a href="mailto:jwatte@gmail.com">jwatte@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div>unfortunately, when I do this, the paths that come out of the compiler error messages does not contain the "apps" directory or the name of the actual app. For example, if I have an error in the file "apps/myapp/src/somefile.erl" then the error message will say "src/somefile.erl:44: some error here."</div>

<div>THIS, in turn, breaks the go-to-compile-error logic for the editor -- it cannot find the file in question. I can string-substitute the output of rebar to tack on "apps/" in front, but without the actual application, that's not good enough, and I don't easily know which app name to also tack on.</div>

<div><br></div><div>So -- how do you guys solve this? Jumping to compile errors in the editor is one of those basics that nobody really wants to live without, so I can't imagine that an entire community is living without...</div>

<div><br></div><div></div></blockquote></div><br><div>I think rebar is not the source of the shortened error message here, but rather the error message is being generated by the `compile' module itself. The rebar_erlc_compiler does pass on the 'report' option to compile:file/2, but this just prints out warnings and errors. The reason that the error message only contains the 'src' directory is that rebar changes into subdirectories (using file:set_cwd/1) before processing them. If you wanted to annotate the errors, you'd need to patch rebar_erlc_compiler and do something like:</div>
<div><br></div><div>case compile:file(Source, [return_errors|Opts]) of</div><div>    {ok, _} -> ok;</div><div>    {error, Errors, _} -></div><div>        [ ?ERROR("~s: ~s", [filename:absname(File), </div><div>
                compile:format_error(Err)]) || {F, Err} <- Errors ],</div><div>        ?ABORT("Compilation failed!~n", [])</div><div>end;</div><div><br></div><div>The place you'd need to make that change is here: <a href="https://github.com/basho/rebar/blob/master/src/rebar_erlc_compiler.erl#L258">https://github.com/basho/rebar/blob/master/src/rebar_erlc_compiler.erl#L258</a></div>
<div><br></div><div>HTH. BTW I have no idea whether or not this would make it into rebar, nor if it's even the best approach. There may be far better ways of doing this, so I'd suggest discussion on the rebar mailing list as a next step, unless you're happy maintaining your own fork.</div>
<div><br></div><div>Cheers,</div><div><br></div><div>Tim</div>