From b764f5423c63b590a32a537001c2054cb052b2c4 Mon Sep 17 00:00:00 2001 From: tastytea Date: Thu, 27 May 2021 10:14:56 +0200 Subject: [PATCH] Put input files into a std::vector. We need that for supporting recursive directory search later. # # Previous commits: # 29ae22c Make regex const. # 8ed72af Update german translation. # a3b0964 Remove old comment. # d107ce5 Modify config file example. --- src/main.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index fd37cb0..9a19ed3 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -78,12 +78,17 @@ int main(int argc, char *argv[]) return EXIT_SUCCESS; } + vector input_files; if (vm.count("input-file") == 0) { cout << "NO INPUT FILE\n"; // TODO: Read data from stdin. return EXIT_FAILURE; } + for (const auto &filepath : vm["input-file"].as>()) + { + input_files.emplace_back(filepath); + } int return_code{EXIT_SUCCESS}; @@ -118,7 +123,7 @@ int main(int argc, char *argv[]) vector> futurepool; auto search_file{ - [&vm, &matches_all, &opts](std::string_view filepath) + [&vm, &matches_all, &opts](fs::path filepath) { for (const auto ®ex : vm["regexp"].as>()) { @@ -172,7 +177,7 @@ int main(int argc, char *argv[]) return static_cast(std::ceil(n / 2 + n / 4)); }()}; - for (const auto &filepath : vm["input-file"].as>()) + for (const auto &filepath : input_files) { if (futurepool.size() >= max_threads) {