mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-01 19:58:15 +00:00
[Python] Fix generating __init__.py for invalid path (#8810)
This tried to generate from a directories "MyGame/Sample/" for a empty path_ in M, MyGame & MyGame/Sample. Which is incorrect since we want to start with the first kPathSeparator `/` and not position 1.
This commit is contained in:
@@ -2884,7 +2884,8 @@ class PythonGenerator : public BaseGenerator {
|
||||
parser_.opts.one_file ? path_ : namer_.Directories(ns.components);
|
||||
EnsureDirExists(directories);
|
||||
|
||||
for (size_t i = path_.size() + 1; i != std::string::npos;
|
||||
for (size_t i = directories.find(kPathSeparator, path_.size());
|
||||
i != std::string::npos;
|
||||
i = directories.find(kPathSeparator, i + 1)) {
|
||||
const std::string init_py =
|
||||
directories.substr(0, i) + kPathSeparator + "__init__.py";
|
||||
|
||||
Reference in New Issue
Block a user