From c7b601b62465c7d38daed6fcc916bd94fdead1cf Mon Sep 17 00:00:00 2001 From: raysan5 Date: Sat, 13 Oct 2018 15:59:17 +0200 Subject: [PATCH] Renamed new PR function RENAME: GetLastWriteTime() to GetFileModTime() --- src/core.c | 11 +++++++---- src/raylib.h | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/core.c b/src/core.c index 3b54c05c8..7162f47d2 100644 --- a/src/core.c +++ b/src/core.c @@ -1682,15 +1682,18 @@ void ClearDroppedFiles(void) #endif } -// Get the last write time of a file -long GetLastWriteTime(const char *fileName) +// Get file modification time (last write time) +RLAPI long GetFileModTime(const char *fileName) { - struct stat result = {0}; + struct stat result = { 0 }; + if (stat(fileName, &result) == 0) { time_t mod = result.st_mtime; - return mod; + + return (long)mod; } + return 0; } diff --git a/src/raylib.h b/src/raylib.h index 1765b40b3..e0b6a5a41 100644 --- a/src/raylib.h +++ b/src/raylib.h @@ -880,7 +880,7 @@ RLAPI bool ChangeDirectory(const char *dir); // Change work RLAPI bool IsFileDropped(void); // Check if a file has been dropped into window RLAPI char **GetDroppedFiles(int *count); // Get dropped files names (memory should be freed) RLAPI void ClearDroppedFiles(void); // Clear dropped files paths buffer (free memory) -RLAPI long GetLastWriteTime(const char *fileName); // Get last write time of a file +RLAPI long GetFileModTime(const char *fileName); // Get file modification time (last write time) // Persistent storage management RLAPI void StorageSaveValue(int position, int value); // Save integer value to storage file (to defined position)