| 577 | // ------------------------------------------------------------------------------------------------- |
| 578 | |
| 579 | void add_files ( |
| 580 | const directory& dir, |
| 581 | const std::string& out_dir, |
| 582 | map_string_to_string& file_map, |
| 583 | bool flatten, |
| 584 | bool cat, |
| 585 | const set_of_string& filter, |
| 586 | unsigned long search_depth, |
| 587 | const std::set<std::filesystem::path>& explicit_inputs, |
| 588 | unsigned long cur_depth |
| 589 | ) |
| 590 | { |
| 591 | const char separator = directory::get_separator(); |
| 592 | |
| 593 | queue_of_files files; |
| 594 | queue_of_dirs dirs; |
| 595 | |
| 596 | dir.get_files(files); |
| 597 | |
| 598 | // look though all the files in the current directory and add the |
| 599 | // ones that match the filter to file_map |
| 600 | string name, ext, in_file, out_file; |
| 601 | files.reset(); |
| 602 | while (files.move_next()) |
| 603 | { |
| 604 | name = files.element().name(); |
| 605 | string::size_type pos = name.find_last_of('.'); |
| 606 | if (pos != string::npos && filter.is_member(name.substr(pos+1))) |
| 607 | { |
| 608 | in_file = files.element().full_name(); |
| 609 | // Explicit command-line files keep their requested output location. |
| 610 | if (explicit_inputs.count(fs::weakly_canonical(in_file))) |
| 611 | continue; |
| 612 | |
| 613 | if (flatten) |
| 614 | { |
| 615 | pos = in_file.find_last_of(separator); |
| 616 | } |
| 617 | else |
| 618 | { |
| 619 | // figure out how much of the file's path we need to keep |
| 620 | // for the output file name |
| 621 | pos = in_file.size(); |
| 622 | for (unsigned long i = 0; i <= cur_depth && pos != string::npos; ++i) |
| 623 | { |
| 624 | pos = in_file.find_last_of(separator,pos-1); |
| 625 | } |
| 626 | } |
| 627 | |
| 628 | if (pos != string::npos) |
| 629 | { |
| 630 | out_file = out_dir + in_file.substr(pos+1) + ".html"; |
| 631 | } |
| 632 | else |
| 633 | { |
| 634 | out_file = out_dir + in_file + ".html"; |
| 635 | } |
| 636 |
no test coverage detected