23 #include "directoryScan.hpp" 26 namespace fs = boost::filesystem;
36 fs::recursive_directory_iterator dirIterator(directoryPath);
37 fs::recursive_directory_iterator end;
41 vector<string> filePaths;
43 for (fs::path
const &p : boost::make_iterator_range(dirIterator, {}))
45 if (fs::is_directory(p))
52 filePaths.push_back(p.string());
54 const unsigned long filePathsSize = filePaths.size();
55 bool printComma =
false;
61 #pragma omp parallel shared(printComma) 64 for (
unsigned int i = 0; i < filePathsSize; i++)
66 const string fileName = filePaths[i];
71 l = agentObj.processFile(fileName);
73 catch (std::runtime_error &e)
75 cerr <<
"Unable to read " << e.what();
78 pair<string, vector<ojomatch>> scanResult(fileName, l);
91 cout << endl <<
"]" << endl;
void printResultToStdout(const std::string fileName, const std::pair< string, list< match >> resultPair)
void scanDirectory(const bool json, const string &directoryPath)
void appendToJson(const std::string fileName, const std::pair< string, list< match >> resultPair, bool &printComma)