Skip to content

Commit

Permalink
MINIFICPP-915 - add util to list all of a directory without callback
Browse files Browse the repository at this point in the history
  • Loading branch information
dtrodrigues committed Sep 2, 2019
1 parent 97a05c1 commit 5372880
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions libminifi/include/utils/file/FileUtils.h
Expand Up @@ -19,6 +19,7 @@

#include <sstream>
#include <fstream>
#include <vector>
#ifdef BOOST_VERSION
#include <boost/filesystem.hpp>
#else
Expand Down Expand Up @@ -402,6 +403,16 @@ class FileUtils {
#endif
}

static void list_dir_all(std::vector<std::pair<std::string, std::string>> &fileList, const std::string& dir,
const std::shared_ptr<logging::Logger> &logger, bool recursive = true) {

auto lambda = [&fileList] (const std::string &path, const std::string &filename) {
fileList.push_back(make_pair(path, filename));
return true;
};
list_dir(dir, lambda, logger, recursive);
}

/*
* Provides a platform-independent function to list a directory
* Callback is called for every file found: first argument is the path of the directory, second is the filename
Expand Down

0 comments on commit 5372880

Please sign in to comment.