mirror of
https://github.com/vee1e/flatbuffers.git
synced 2026-09-01 17:57:25 +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:
parent
807b43c0d7
commit
49d2db93a7
1 changed files with 2 additions and 1 deletions
|
|
@ -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";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue