adamdebreceni commented on a change in pull request #1015:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1015#discussion_r582667443
##########
File path: extensions/standard-processors/processors/GetFile.cpp
##########
@@ -228,42 +228,49 @@ void GetFile::pollListing(std::queue<std::string> &list,
const GetFileRequest &r
bool GetFile::acceptFile(std::string fullName, std::string name, const
GetFileRequest &request) {
logger_->log_trace("Checking file: %s", fullName);
+#ifdef WIN32
+ struct _stat64 statbuf;
+ if (_stat64(fullName.c_str(), &statbuf) != 0) {
+ return false;
+ }
+#else
struct stat statbuf;
+ if (stat(fullName.c_str(), &statbuf) != 0) {
+ return false;
+ }
+#endif
+ uint64_t file_size = gsl::narrow<uint64_t>(statbuf.st_size);
+ uint64_t modifiedTime = gsl::narrow<uint64_t>(statbuf.st_mtime) * 1000;
Review comment:
you are right about our inconsistent time representations (we use
`uint64_t`, `int64_t` and `time_t` in `TimeUtil.h` to represent time) we should
unify it, based on the POSIX and Windows documentations, as I understand we may
(cautiously) assume that `st_mtime` yields the Unix time, so these narrowings
and the subsequent scaling should be fine
----------------------------------------------------------------
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]