Skip to content

giscanner: Print relative filename paths when warning

g-ir-scanner would cut away the 'common prefix' between the current working directory and the file about be warned about. This is problematic when using automatic jumping to warnings and errors, as it'd mean the editor can't find the relevant file.

For example, if g-ir-scanner is run from 'build/', and a warning occurs on a file in 'src/file.c', the scanner would print the warning 'src/file.c:123: Warning: This and that'. Running this from e.g. meson would mean e.g. VIM would not find the correct file to jump to.

Meanwhile, GCC, in the same setup, would print '../src/file.c:123: Warning: ...', as that is the relative path from where the scanner is ran, and e.g. VIM would behave in a correct way.

Merge request reports