mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-02 20:15:34 +00:00
File identifier feature.
Allows you to add, and test for the presence of a magic 4-char string in a FlatBuffer. Tested: on OS X. Change-Id: I090692a9e4fb53bed3543279a28563e67132cba0
This commit is contained in:
@@ -27,9 +27,10 @@ bool GenerateBinary(const Parser &parser,
|
||||
const std::string &path,
|
||||
const std::string &file_name,
|
||||
const GeneratorOptions & /*opts*/) {
|
||||
auto ext = parser.file_extension_.length() ? parser.file_extension_ : "bin";
|
||||
return !parser.builder_.GetSize() ||
|
||||
flatbuffers::SaveFile(
|
||||
(path + file_name + ".bin").c_str(),
|
||||
(path + file_name + "." + ext).c_str(),
|
||||
reinterpret_cast<char *>(parser.builder_.GetBufferPointer()),
|
||||
parser.builder_.GetSize(),
|
||||
true);
|
||||
|
||||
Reference in New Issue
Block a user