Commit 06ac6df 1 parent 30fb2ca commit 06ac6df Copy full SHA for 06ac6df
File tree 2 files changed +30
-0
lines changed
2 files changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -212,6 +212,10 @@ namespace dd
212
212
{
213
213
std::vector<std::string> selts = dd_utils::split ((*hit), ' /' );
214
214
fileops::copy_file ((*hit), target_repo + ' /' + selts.back ());
215
+ if (selts.back ().find (" .json" ) != std::string::npos)
216
+ fileops::replace_string_in_file (target_repo + ' /'
217
+ + selts.back (),
218
+ " db\" :true" , " db\" :false" );
215
219
}
216
220
++hit;
217
221
}
Original file line number Diff line number Diff line change @@ -286,6 +286,32 @@ namespace dd
286
286
return 0 ;
287
287
}
288
288
289
+ static int replace_string_in_file (const std::string &filename,
290
+ const std::string &search,
291
+ const std::string &replace)
292
+ {
293
+ int nr = 0 ;
294
+ std::ifstream ifs (filename.c_str (),
295
+ std::ios::in | std::ios::binary | std::ios::ate);
296
+ std::stringstream sstr;
297
+ sstr << ifs.rdbuf ();
298
+ ifs.close ();
299
+ std::string filestring = sstr.str ();
300
+
301
+ size_t pos = 0 ;
302
+ while ((pos = filestring.find (search, pos)) != std::string::npos)
303
+ {
304
+ filestring.replace (pos, search.length (), replace);
305
+ pos += replace.length ();
306
+ nr++;
307
+ }
308
+ std::ofstream out (filename.c_str (),
309
+ std::ios::out | std::ios::binary | std::ios::trunc );
310
+ out << filestring;
311
+ out.close ();
312
+ return nr;
313
+ }
314
+
289
315
static int copy_uncompressed_data (struct archive *ar, struct archive *aw)
290
316
{
291
317
int r;
You can’t perform that action at this time.
0 commit comments