| 484 | } |
| 485 | |
| 486 | static void strip_cluster(const std::string& lrlpath, |
| 487 | const std::string& lrldest) |
| 488 | { |
| 489 | std::ifstream instream(lrlpath.c_str()); |
| 490 | if(!instream.is_open()) { |
| 491 | throw LRLError(lrlpath, 0, "cannot open file"); |
| 492 | } |
| 493 | |
| 494 | std::ofstream outstream(lrldest.c_str()); |
| 495 | if(!outstream.is_open()) { |
| 496 | throw LRLError(lrldest, 0, "cannot open file"); |
| 497 | } |
| 498 | |
| 499 | while(!instream.eof()) { |
| 500 | std::string line; |
| 501 | std::getline(instream, line); |
| 502 | |
| 503 | std::istringstream liness(line); |
| 504 | |
| 505 | std::string tok; |
| 506 | |
| 507 | if(liness >> tok && tok == "cluster") { |
| 508 | outstream << "#" << line << std::endl; |
| 509 | } else { |
| 510 | outstream << line << std::endl; |
| 511 | } |
| 512 | } |
| 513 | } |
| 514 | |
| 515 | static bool file_exists(const std::string &path) { |
| 516 | int rc = access(path.c_str(), F_OK); |
no test coverage detected