Make --bfbs-filenames default to location of first schema file. (#6705)

* Make --bfbs-filenames default to location of first schema file.

Make RelativeToProjectRoot always work, applying "../" where needed. This is
needed for backwards compatibility. The first input file may be deeper in some
directory than the other files. Now, there will always be a declaration
file.

* documentation

* clang format

Co-authored-by: Casper Neo <cneo@google.com>
This commit is contained in:
Casper
2021-06-22 10:19:46 -04:00
committed by GitHub
parent c8db1ca5d4
commit 71d43f3be9
4 changed files with 34 additions and 19 deletions

View File

@@ -1339,7 +1339,6 @@ void ParseProtoTestWithIncludes() {
flatbuffers::IDLOptions opts;
opts.include_dependence_headers = true;
opts.proto_mode = true;
opts.project_root = test_data_path;
// Parse proto.
flatbuffers::Parser parser(opts);
@@ -1357,9 +1356,7 @@ void ParseProtoTestWithIncludes() {
auto import_fbs = flatbuffers::GenerateFBS(import_parser, "test");
// Ensure generated file is parsable.
flatbuffers::IDLOptions opts2;
opts2.project_root = protopath;
flatbuffers::Parser parser2(opts2);
flatbuffers::Parser parser2;
// Since `imported.fbs` isn't in the filesystem AbsolutePath can't figure it
// out by itself. We manually construct it so Parser works.
std::string imported_fbs = flatbuffers::PosixPath(