namespace flatbuffers {
+static const char kPosixPathSeparator = '/';
+#ifdef _WIN32
+static const char kPathSeparator = '\\';
+#else
+static const char kPathSeparator = kPosixPathSeparator;
+#endif // _WIN32
+
// Convert an integer or floating point value to a string.
// In contrast to std::stringstream, "char" values are
// converted to a string of digits.
case 'o':
if (++i >= argc) Error("missing path following", arg, true);
output_path = argv[i];
+ if (!(output_path.back() == flatbuffers::kPathSeparator ||
+ output_path.back() == flatbuffers::kPosixPathSeparator)) {
+ output_path += flatbuffers::kPathSeparator;
+ }
break;
case 'S':
opts.strict_json = true;
return 0;
}
-
#ifdef _WIN32
#include <direct.h>
-#define PATH_SEPARATOR "\\"
#define mkdir(n, m) _mkdir(n)
#else
#include <sys/stat.h>
-#define PATH_SEPARATOR "/"
#endif
namespace flatbuffers {
it != parser.name_space_.end(); ++it) {
if (name_space_java.length()) {
name_space_java += ".";
- name_space_dir += PATH_SEPARATOR;
+ name_space_dir += kPathSeparator;
}
name_space_java += *it;
name_space_dir += *it;
code += "import flatbuffers.*;\n\n";
}
code += classcode;
- auto filename = name_space_dir + PATH_SEPARATOR + def.name + ".java";
+ auto filename = name_space_dir + kPathSeparator + def.name + ".java";
return SaveFile(filename.c_str(), code, false);
}
}
} // namespace flatbuffers
-