arpadboda commented on a change in pull request #522: MINIFICPP-786 - GetFile
processor doesn't seem to work with default c…
URL: https://github.com/apache/nifi-minifi-cpp/pull/522#discussion_r268620058
##########
File path: libminifi/src/processors/GetFile.cpp
##########
@@ -277,65 +275,13 @@ bool GetFile::acceptFile(std::string fullName,
std::string name, const GetFileRe
}
void GetFile::performListing(std::string dir, const GetFileRequest &request) {
-#ifndef WIN32
- DIR *d;
- d = opendir(dir.c_str());
- if (!d)
- return;
- // only perform a listing while we are not empty
- logger_->log_debug("Performing file listing against %s", dir);
- while (isRunning()) {
- struct dirent *entry;
- entry = readdir(d);
- if (!entry)
- break;
- std::string d_name = entry->d_name;
- std::string path = dir + "/" + d_name;
- struct stat statbuf { };
- if (stat(path.c_str(), &statbuf) != 0) {
- logger_->log_warn("Failed to stat %s", path);
- break;
- }
- if (S_ISDIR(statbuf.st_mode)) {
- // if this is a directory
- if (request.recursive && strcmp(d_name.c_str(), "..") != 0 &&
strcmp(d_name.c_str(), ".") != 0) {
- performListing(path, request);
- }
- } else {
- if (acceptFile(path, d_name, request)) {
- // check whether we can take this file
- putListing(path);
- }
+ auto callback = [this, request](const std::string& dir, const std::string&
filename) {
+ std::string fullpath = dir + utils::file::FileUtils::get_separator() +
filename;
Review comment:
Good point, added, thanks!
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services