aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/FileUtil.hpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/include/FileUtil.hpp b/include/FileUtil.hpp
index d740fff..b88d58a 100644
--- a/include/FileUtil.hpp
+++ b/include/FileUtil.hpp
@@ -41,6 +41,14 @@ namespace sibs
// Return true if you want to continue iterating the remaining files, return false if you want to stop
using FileWalkCallbackFunc = std::function<bool(tinydir_file*)>;
+ struct FileWithTimestamp {
+ FileString filepath;
+ FileString extension;
+ struct timespec last_modified;
+ };
+
+ using SortedFileWalkCallbackFunc = std::function<bool(const FileWithTimestamp&)>;
+
enum class FileType
{
FILE_NOT_FOUND,
@@ -52,6 +60,7 @@ namespace sibs
void walkDir(const _tinydir_char_t *directory, FileWalkCallbackFunc callbackFunc);
void walkDirFiles(const _tinydir_char_t *directory, FileWalkCallbackFunc callbackFunc);
bool walkDirFilesRecursive(const _tinydir_char_t *directory, FileWalkCallbackFunc callbackFunc);
+ bool walkDirFilesRecursiveSortTimestamp(const _tinydir_char_t *directory, SortedFileWalkCallbackFunc callbackFunc);
Result<StringView> getFileContent(const _tinydir_char_t *filepath);
Result<bool> fileWrite(const _tinydir_char_t *filepath, StringView data);
Result<bool> fileOverwrite(const _tinydir_char_t *filepath, StringView data);