Skip to content

Commit

Permalink
compiler/cpp/src/generate/t_json_generator: namespace the output
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexisMontagne committed Oct 15, 2024
1 parent 337a8e1 commit 8e95b25
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions compiler/cpp/src/generate/t_json_generator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,20 @@ class t_json_generator : public t_generator {
};

void t_json_generator::init_generator() {
MKDIR(get_out_dir().c_str());
string subdir = get_out_dir();

string f_json_name = get_out_dir() + program_->get_name() + ".json";
MKDIR(subdir.c_str());

std::string dir = program_->get_namespace("json");
string::size_type loc;

while ((loc = dir.find(".")) != string::npos) {
subdir = subdir + underscore(dir.substr(0, loc)) + "/";
MKDIR(subdir.c_str());
dir = dir.substr(loc + 1);
}

string f_json_name = subdir + program_->get_name() + ".json";
f_json_.open(f_json_name.c_str());

// Merge all included programs into this one so we can output one big file.
Expand Down

0 comments on commit 8e95b25

Please sign in to comment.