| 192 | return Json::writeString(builder, root); |
| 193 | } |
| 194 | static int rewriteValueTree( |
| 195 | const JSONCPP_STRING& rewritePath, |
| 196 | const Json::Value& root, |
| 197 | Options::writeFuncType write, |
| 198 | JSONCPP_STRING* rewrite) |
| 199 | { |
| 200 | *rewrite = write(root); |
| 201 | FILE* fout = fopen(rewritePath.c_str(), "wt"); |
| 202 | if (!fout) { |
| 203 | printf("Failed to create rewrite file: %s\n", rewritePath.c_str()); |
| 204 | return 2; |
| 205 | } |
| 206 | fprintf(fout, "%s\n", rewrite->c_str()); |
| 207 | fclose(fout); |
| 208 | return 0; |
| 209 | } |
| 210 | |
| 211 | static JSONCPP_STRING removeSuffix(const JSONCPP_STRING& path, |
| 212 | const JSONCPP_STRING& extension) { |