diff options
Diffstat (limited to 'node/Utils.cpp')
| -rw-r--r-- | node/Utils.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/node/Utils.cpp b/node/Utils.cpp index 31cb40dd..608de593 100644 --- a/node/Utils.cpp +++ b/node/Utils.cpp @@ -246,7 +246,7 @@ no getSecureRandom() implementation; void Utils::lockDownFile(const char *path,bool isDir) { -#if defined(__APPLE__) || defined(__linux__) || defined(linux) || defined(__LINUX__) || defined(__linux) +#ifdef __UNIX_LIKE__ chmod(path,isDir ? 0700 : 0600); #else #ifdef _WIN32 @@ -263,6 +263,16 @@ uint64_t Utils::getLastModified(const char *path) return (((uint64_t)s.st_mtime) * 1000ULL); } +bool Utils::fileExists(const char *path,bool followLinks) +{ + struct stat s; +#ifdef __UNIX_LIKE__ + if (!followLinks) + return (lstat(path,&s) == 0); +#endif + return (stat(path,&s) == 0); +} + int64_t Utils::getFileSize(const char *path) { struct stat s; |
