Thursday, January 24, 2013

Re: Quickfix Has Wrong Path to Source Files

On Wednesday, January 23, 2013 4:10:22 PM UTC-6, Stephen Rasku wrote:
> I'm not quite sure what you mean about "makefile specify[ing] absolute
>
> paths".

You said you fixed the problem by making ccfilter not prepend the current directory.

The string being prepended is "build/i586-linux/" so I assume you're building from that directory.

But the build itself gives errors from files in a completely different directory, giving absolute path "/local/work/dept/user/repo.git/src/fd_set/src/"

I assumed that meant your makefile was specifying /local/work/dept/user/repo.git/src/fd_set.c via absolute path.

> In a large project it's fairly common for Makefiles to call
>
> other Makefiles to build the whole system.

Yes, and now that I think about it, a lot of my makefiles use environment variables built by modifying the the current working directory, which could easily result in absolute paths. Or the compiler may output absolute paths in the error output without the makefile using them. It is still strange to me that you seem to be compiling files in a location not related at all to your current directory. I was speculating as to the reason the ccfilter might be prepending current path. Apparently it fails in some situations which are more common than I thought.

> If you are in the current
>
> directory, there's no need to prepend the current directory. Relative
>
> paths should work. I may be missing something, though.
>

Relative paths will only work as long as Vim stays in the same directory. Loading some build output with :cfile can be quite difficult if relative paths are used, and I think I've seen quirks even when using :make.

Probably the correct thing to do is to prepend current directoy, but only if the path is relative. If the path is absolute, don't prepend anything.

Or even better, resolve the full path based on current directory always, and replace the full path string with the resolved path. This will also "fix" paths like project/p1/../libs/p2 to become /home/accts/johndoe/project/libs/p2.

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments:

Post a Comment