diff options
author | dec05eba <dec05eba@protonmail.com> | 2018-01-02 17:38:18 +0100 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2018-01-02 20:10:53 +0100 |
commit | 87a65f6913429b26e63fdee17cb8cfe93990db35 (patch) | |
tree | c2cfac67fc09f9c364869a107a140c34c5b73fd8 /src/FileUtil.cpp | |
parent | e8afe1630280335e5c7f4938f7c265b8798049d1 (diff) |
Add support for cmake
Not working fully yet, will investigate why
Diffstat (limited to 'src/FileUtil.cpp')
-rw-r--r-- | src/FileUtil.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
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<u64> getFileLastModifiedTime(const _tinydir_char_t *path) + { + struct stat64 fileStat; + if (stat64(path, &fileStat) == 0) + return Result<u64>::Ok(fileStat.st_mtim.tv_sec); + else + { + string errMsg = "File not found: "; + errMsg += toUtf8(path); + return Result<u64>::Err(errMsg); + } + } #else FileType getFileType(const _tinydir_char_t *path) { @@ -110,6 +123,19 @@ namespace sibs else return FileType::FILE_NOT_FOUND; } + + Result<u64> getFileLastModifiedTime(const _tinydir_char_t *path) + { + struct _stat64i32 fileStat; + if (_wstat(path, &fileStat) == 0) + rreturn Result<u64>::Ok(fileStat.st_mtim.tv_sec); + else + { + string errMsg = "File not found: "; + errMsg += toUtf8(path); + return Result<u64>::Err(errMsg); + } + } #endif // TODO: Handle failure (directory doesn't exist, no permission etc) |