From 4d1a9f8d9eab9fc6762e03cd862576965a0c6920 Mon Sep 17 00:00:00 2001 From: Michael Beardsworth Date: Thu, 19 Dec 2019 13:03:47 -0800 Subject: [PATCH] Keep include prefix when converting from proto. This change preserves the include prefix when generating flatbuffers from proto (with FBS_GEN_INCLUDES) defined. --- src/idl_gen_fbs.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/idl_gen_fbs.cpp b/src/idl_gen_fbs.cpp index e5f3723cb..ed31637fb 100644 --- a/src/idl_gen_fbs.cpp +++ b/src/idl_gen_fbs.cpp @@ -75,8 +75,13 @@ std::string GenerateFBS(const Parser &parser, const std::string &file_name) { it != parser.included_files_.end(); ++it) { if (it->second.empty()) continue; - auto basename = flatbuffers::StripPath( - flatbuffers::StripExtension(it->second)); + std::string basename; + if(parser.opts.keep_include_path) { + basename = flatbuffers::StripPath( + flatbuffers::StripExtension(it->second)); + } else { + basename = flatbuffers::StripExtension(it->second); + } schema += "include \"" + basename + ".fbs\";\n"; num_includes++; }