This is an automated email from the ASF dual-hosted git repository.
aboda pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nifi-minifi-cpp.git
The following commit(s) were added to refs/heads/master by this push:
new a5a260b MINIFICPP-915 - add util to list all of a directory without
callback
a5a260b is described below
commit a5a260b0924c657016d3527a624b46b088f3d053
Author: Dustin Rodrigues <[email protected]>
AuthorDate: Mon Sep 2 17:20:22 2019 -0400
MINIFICPP-915 - add util to list all of a directory without callback
Signed-off-by: Arpad Boda <[email protected]>
This closes #640
---
libminifi/include/utils/file/FileUtils.h | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/libminifi/include/utils/file/FileUtils.h
b/libminifi/include/utils/file/FileUtils.h
index db9182e..91fc130 100644
--- a/libminifi/include/utils/file/FileUtils.h
+++ b/libminifi/include/utils/file/FileUtils.h
@@ -19,6 +19,7 @@
#include <sstream>
#include <fstream>
+#include <vector>
#ifdef BOOST_VERSION
#include <boost/filesystem.hpp>
#else
@@ -402,6 +403,20 @@ class FileUtils {
#endif
}
+ static std::vector<std::pair<std::string, std::string>> list_dir_all(const
std::string& dir, const std::shared_ptr<logging::Logger> &logger,
+ bool
recursive = true) {
+
+ std::vector<std::pair<std::string, std::string>> fileList;
+ 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);
+
+ return fileList;
+ }
+
/*
* 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