12 #include "directoryScan.hpp"
15 namespace fs = boost::filesystem;
25 fs::recursive_directory_iterator dirIterator(directoryPath);
26 fs::recursive_directory_iterator end;
30 vector<string> filePaths;
32 for (fs::path
const &p : boost::make_iterator_range(dirIterator, {}))
34 if (fs::is_directory(p))
41 filePaths.push_back(p.string());
43 const unsigned long filePathsSize = filePaths.size();
44 bool printComma =
false;
50 #pragma omp parallel shared(printComma)
53 for (
unsigned int i = 0; i < filePathsSize; i++)
55 const string fileName = filePaths[i];
60 l = agentObj.processFile(fileName);
62 catch (std::runtime_error &e)
64 cerr <<
"Unable to read " << e.what();
67 pair<string, vector<ojomatch>> scanResult(fileName, l);
80 cout << endl <<
"]" << endl;
void printResultToStdout(const std::vector< tuple< string, string, bool >> &resultPair, const std::string &fileName)
void appendToJson(const std::vector< tuple< string, string, bool >> &resultPair, const std::string &fileName, bool &printComma)
void scanDirectory(const bool json, const string &directoryPath)