MCPcopy Create free account
hub / github.com/RcppCore/Rcpp / FileInfo

Method FileInfo

src/attributes.cpp:2978–2997  ·  view source on GitHub ↗

Utility class for getting file existence and last modified time

Source from the content-addressed store, hash-verified

2976
2977 // Utility class for getting file existence and last modified time
2978 FileInfo::FileInfo(const std::string& path)
2979 : path_(path), exists_(false), lastModified_(0)
2980 {
2981 #ifdef _WIN32
2982 struct _stat buffer;
2983 int result = _stat(path.c_str(), &buffer);
2984 #else
2985 struct stat buffer;
2986 int result = stat(path.c_str(), &buffer);
2987 #endif
2988 if (result != 0) {
2989 if (errno == ENOENT)
2990 exists_ = false;
2991 else
2992 throw Rcpp::file_io_error(errno, path); // #nocov
2993 } else {
2994 exists_ = true;
2995 lastModified_ = static_cast<double>(buffer.st_mtime);
2996 }
2997 }
2998
2999 // Remove a file (call back into R for this)
3000 bool removeFile(const std::string& path) {

Callers

nothing calls this directly

Calls 3

_statClass · 0.85
statClass · 0.85
file_io_errorClass · 0.85

Tested by

no test coverage detected