From 3368407affe57bdaf11d9e89fb1087c4e15d3457 Mon Sep 17 00:00:00 2001 From: Wouter van Oortmerssen Date: Wed, 14 Sep 2016 11:39:33 -0700 Subject: [PATCH] Add a --conform-includes flag to specify include path for the conform schema (mirrored from cl 133146933) Change-Id: I61385289728777cae83139fef0229001d92382ca --- src/flatc.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/flatc.cpp b/src/flatc.cpp index 5ca7ab3b5..bb9f395d5 100644 --- a/src/flatc.cpp +++ b/src/flatc.cpp @@ -133,6 +133,8 @@ static void Error(const std::string &err, bool usage, bool show_exe_name) { " --schema Serialize schemas instead of JSON (use with -b)\n" " --conform FILE Specify a schema the following schemas should be\n" " an evolution of. Gives errors if not.\n" + " --conform-includes Include path for the schema given with --conform\n" + " PATH \n" "FILEs may be schemas, or JSON files (conforming to preceding schema)\n" "FILEs after the -- must be binary flatbuffer format files.\n" "Output files are named using the base file name of the input,\n" @@ -169,6 +171,7 @@ int main(int argc, const char *argv[]) { bool schema_binary = false; std::vector filenames; std::vector include_directories; + std::vector conform_include_directories; size_t binary_files_from = std::numeric_limits::max(); std::string conform_to_schema; for (int argi = 1; argi < argc; argi++) { @@ -185,6 +188,9 @@ int main(int argc, const char *argv[]) { } else if(arg == "--conform") { if (++argi >= argc) Error("missing path following" + arg, true); conform_to_schema = argv[argi]; + } else if (arg == "--conform-includes") { + if (++argi >= argc) Error("missing path following" + arg, true); + conform_include_directories.push_back(argv[argi]); } else if(arg == "--strict-json") { opts.strict_json = true; } else if(arg == "--allow-non-utf8") { @@ -265,7 +271,8 @@ int main(int argc, const char *argv[]) { std::string contents; if (!flatbuffers::LoadFile(conform_to_schema.c_str(), true, &contents)) Error("unable to load schema: " + conform_to_schema); - ParseFile(conform_parser, conform_to_schema, contents, include_directories); + ParseFile(conform_parser, conform_to_schema, contents, + conform_include_directories); } // Now process the files: