From 87a65f6913429b26e63fdee17cb8cfe93990db35 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Tue, 2 Jan 2018 17:38:18 +0100 Subject: Add support for cmake Not working fully yet, will investigate why --- src/FileUtil.cpp | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'src/FileUtil.cpp') diff --git a/src/FileUtil.cpp b/src/FileUtil.cpp index 2626ee3..7541a61 100644 --- a/src/FileUtil.cpp +++ b/src/FileUtil.cpp @@ -101,6 +101,19 @@ namespace sibs else return FileType::FILE_NOT_FOUND; } + + Result getFileLastModifiedTime(const _tinydir_char_t *path) + { + struct stat64 fileStat; + if (stat64(path, &fileStat) == 0) + return Result::Ok(fileStat.st_mtim.tv_sec); + else + { + string errMsg = "File not found: "; + errMsg += toUtf8(path); + return Result::Err(errMsg); + } + } #else FileType getFileType(const _tinydir_char_t *path) { @@ -110,6 +123,19 @@ namespace sibs else return FileType::FILE_NOT_FOUND; } + + Result getFileLastModifiedTime(const _tinydir_char_t *path) + { + struct _stat64i32 fileStat; + if (_wstat(path, &fileStat) == 0) + rreturn Result::Ok(fileStat.st_mtim.tv_sec); + else + { + string errMsg = "File not found: "; + errMsg += toUtf8(path); + return Result::Err(errMsg); + } + } #endif // TODO: Handle failure (directory doesn't exist, no permission etc) -- cgit v1.2.3