2222using namespace std ;
2323using namespace o2 ::event_visualisation;
2424
25- deque<string> DirectoryLoader::load (const std::string& path, const std::string& marker, const std::string& ext)
25+ deque<string> DirectoryLoader::load (const std::string& path, const std::string& marker, const std::vector<std:: string> & ext)
2626{
2727 deque<string> result;
2828 for (const auto & entry : std::filesystem::directory_iterator (path)) {
29- if (entry.path ().extension () == ext) {
29+ if (std::find (ext. begin (), ext. end (), entry.path ().extension ()) != ext. end () ) {
3030 result.push_back (entry.path ().filename ());
3131 }
3232 }
@@ -58,22 +58,22 @@ std::time_t to_time_t(TP tp)
5858 return system_clock::to_time_t (sctp);
5959}
6060
61- int DirectoryLoader::getNumberOfFiles (std::string& path, std::string& ext)
61+ int DirectoryLoader::getNumberOfFiles (std::string& path, std::vector<std:: string> & ext)
6262{
6363 int res = 0 ;
6464 for (const auto & entry : std::filesystem::directory_iterator (path)) {
65- if (entry.path ().extension () == ext) {
65+ if (std::find (ext. begin (), ext. end (), entry.path ().extension ()) != ext. end () ) {
6666 res++;
6767 }
6868 }
6969 return res;
7070}
71- std::string DirectoryLoader::getLatestFile (std::string& path, std::string& ext)
71+ std::string DirectoryLoader::getLatestFile (std::string& path, std::vector<std:: string> & ext)
7272{
7373 std::string oldest_file_name = " " ;
7474 std::time_t oldest_file_time = LONG_MAX;
7575 for (const auto & entry : std::filesystem::directory_iterator (path)) {
76- if (entry.path ().extension () == ext) {
76+ if (std::find (ext. begin (), ext. end (), entry.path ().extension ()) != ext. end () ) {
7777 auto file_time = entry.last_write_time ();
7878 std::time_t tt = to_time_t (file_time);
7979 if (tt < oldest_file_time) {
@@ -85,7 +85,7 @@ std::string DirectoryLoader::getLatestFile(std::string& path, std::string& ext)
8585 return oldest_file_name;
8686}
8787
88- void DirectoryLoader::removeOldestFiles (std::string& path, std::string ext, int remaining)
88+ void DirectoryLoader::removeOldestFiles (std::string& path, std::vector<std:: string>& ext, int remaining)
8989{
9090 while (getNumberOfFiles (path, ext) > remaining) {
9191 LOG (info) << " removing oldest file in folder: " << path << " : " << getLatestFile (path, ext);
0 commit comments