mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-02 12:05:50 +00:00
flatc now creates the output directory if it doesn't exist yet.
Also cleaned up the general mkdir functionality. Tested: on OS X. Tested that a command line like: ./flatc -j -o foo/bar/baz tests/monster_test.fbs generates files in foo/bar/baz/MyGame/Example/*.java which previously didn't exist. Windows code was previously tested but has been moved, so needs to be tested again. Change-Id: Iee943121b3be4f92961a3ec94c2cb578165f114a
This commit is contained in:
@@ -20,13 +20,6 @@
|
||||
#include "flatbuffers/idl.h"
|
||||
#include "flatbuffers/util.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <direct.h>
|
||||
#define mkdir(n, m) _mkdir(n)
|
||||
#else
|
||||
#include <sys/stat.h>
|
||||
#endif
|
||||
|
||||
namespace flatbuffers {
|
||||
namespace java {
|
||||
|
||||
@@ -351,8 +344,8 @@ static bool SaveClass(const Parser &parser, const Definition &def,
|
||||
}
|
||||
namespace_java += *it;
|
||||
namespace_dir += *it;
|
||||
mkdir(namespace_dir.c_str(), S_IRWXU|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH);
|
||||
}
|
||||
EnsureDirExists(namespace_dir);
|
||||
|
||||
std::string code = "// automatically generated, do not modify\n\n";
|
||||
code += "package " + namespace_java + ";\n\n";
|
||||
|
||||
Reference in New Issue
Block a user