From 650181c6902fcc1d4515f4734c8d4bec73275e6a Mon Sep 17 00:00:00 2001 From: James Moran Date: Fri, 3 Jul 2026 17:41:38 +0100 Subject: [PATCH 1/3] Expose modified time to MTY_FileDesc --- src/matoya.h | 9 +++++---- src/unix/file.c | 1 + 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/matoya.h b/src/matoya.h index 6643f062..59bef677 100644 --- a/src/matoya.h +++ b/src/matoya.h @@ -1836,10 +1836,11 @@ typedef enum { /// @brief File properties. typedef struct { - char *path; ///< The base path to the file. - char *name; ///< The file name. - uint64_t size; ///< The file size in bytes. - bool dir; ///< The file is a directory. + char *path; ///< The base path to the file. + char *name; ///< The file name. + uint64_t size; ///< The file size in bytes. + uint64_t modified_time; ///< the modified time in seconds. + bool dir; ///< The file is a directory. } MTY_FileDesc; /// @brief A list of files. diff --git a/src/unix/file.c b/src/unix/file.c index 4ef270ac..e89e629e 100644 --- a/src/unix/file.c +++ b/src/unix/file.c @@ -235,6 +235,7 @@ MTY_FileList *MTY_GetFileList(const char *path, const char *filter) struct stat st; if (!is_dir && stat(jpath, &st) == 0) fl->files[fl->len].size = st.st_size; + fl->files[fl->len].modified_time = st.st_mtime; fl->len++; } From 77012892bc73bac529c1b4608cb1b39d0d59a0da Mon Sep 17 00:00:00 2001 From: James Moran Date: Wed, 8 Jul 2026 11:24:55 +0100 Subject: [PATCH 2/3] Add accessor for processor ID --- src/matoya.h | 4 ++++ src/unix/system.c | 5 +++++ src/windows/systemw.c | 5 +++++ 3 files changed, 14 insertions(+) diff --git a/src/matoya.h b/src/matoya.h index 59bef677..2f2c021d 100644 --- a/src/matoya.h +++ b/src/matoya.h @@ -2728,6 +2728,10 @@ MTY_ThreadDetach(MTY_ThreadFunc func, void *opaque); MTY_EXPORT int64_t MTY_ThreadGetID(MTY_Thread *ctx); +/// @brief Returns the process ID of the current thread. +MTY_EXPORT uint64_t +MTY_GetCurrentProcessID(); + /// @brief Create an MTY_Mutex for synchronization. /// @details A mutex can be locked by only one thread at a time. Other threads trying /// to take the same mutex will block until it becomes unlocked. diff --git a/src/unix/system.c b/src/unix/system.c index eee98ba0..32abb2a6 100644 --- a/src/unix/system.c +++ b/src/unix/system.c @@ -115,3 +115,8 @@ bool MTY_GetRunOnStartup(const char *name) void MTY_SetRunOnStartup(const char *name, const char *path, const char *args) { } + +uint64_t MTY_GetCurrentProcessID() +{ + return (uint64_t)getpid(); +} diff --git a/src/windows/systemw.c b/src/windows/systemw.c index 457b416a..baf8aceb 100644 --- a/src/windows/systemw.c +++ b/src/windows/systemw.c @@ -391,3 +391,8 @@ void *MTY_GetJNIEnv(void) { return NULL; } + +uint64_t MTY_GetCurrentProcessID() +{ + return (uint64_t)GetCurrentProcessId(); +} From 4534bdbebfd55201139657d7a6be6c3e7b30a255 Mon Sep 17 00:00:00 2001 From: James Moran Date: Thu, 9 Jul 2026 10:25:31 +0100 Subject: [PATCH 3/3] missing cast --- src/windows/filew.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/windows/filew.c b/src/windows/filew.c index 6f1cebf8..04e5fce1 100644 --- a/src/windows/filew.c +++ b/src/windows/filew.c @@ -259,6 +259,7 @@ MTY_FileList *MTY_GetFileList(const char *path, const char *filter) fl->files[fl->len].path = MTY_Strdup(MTY_JoinPath(pathd, name)); fl->files[fl->len].dir = is_dir; fl->files[fl->len].size = (uint64_t) ent.nFileSizeHigh << 32 | ent.nFileSizeLow; + fl->files[fl->len].modified_time = (uint64_t) ent.ftLastWriteTime.dwHighDateTime << 32 | ent.ftLastWriteTime.dwLowDateTime; fl->len++; } else {