mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-02 12:05:50 +00:00
Fixed --keep-prefix functionality.
Changing to keep include prefixes had two side effects: the main file being parsed wasn't filtered out anymore, and include directory paths would be added to the path in the include statement. Also moved the include_test*.fbs files to sub directories so we can actually test the handling of -I etc. tested: on Linux. Change-Id: Ibae095cea7ab0cccbac15cfb5171719f6b5cad8c
This commit is contained in:
@@ -72,11 +72,11 @@ class CppGenerator : public BaseGenerator {
|
||||
}
|
||||
for (auto it = parser_.included_files_.begin();
|
||||
it != parser_.included_files_.end(); ++it) {
|
||||
auto basename = flatbuffers::StripExtension(it->first);
|
||||
if (!parser_.opts.keep_include_path)
|
||||
basename = flatbuffers::StripPath(basename);
|
||||
auto noext = flatbuffers::StripExtension(it->first);
|
||||
auto basename = flatbuffers::StripPath(noext);
|
||||
if (basename != file_name_) {
|
||||
code_ += "#include \"" + parser_.opts.include_prefix + basename +
|
||||
code_ += "#include \"" + parser_.opts.include_prefix +
|
||||
(parser_.opts.keep_include_path ? noext : basename) +
|
||||
"_generated.h\"";
|
||||
num_includes++;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user