flatbuffers: Unexpected --keep-prefix behavior

After #7348, --keep-prefix has unexpected behavior.

Consider the following directory structure:

  • foo/foo.fbs, which contains include 'bar/bar.fbs';
  • foo/bar/bar.fbs

Run:

flatc --cpp --keep-prefix foo/foo.fbs

I’d expect the resulting foo_generated.h to contain #include "bar/bar_generated.h", however with this change it results in #include "foo/bar/bar_generated.h". While it may be useful to add the foo/ prefix, I believe this should be done with --include-prefix foo, since --keep-prefix should only add the prefix contained in the schema.

This is a change from prior versions of flatc, and breaks my out-of-source build system which does not put the generated files in the original foo directory.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 20 (6 by maintainers)

Most upvoted comments

@alexames Thanks for the report and repo. I made #7456 that fixes, at least, the example you shown in your previous comment. Would you like to test this out?