Skip to content

Commit 5c0b0e9

Browse files
committed
Merge pull request #103080 from Alex2782/fix_issue_101007
Fix `modified_time` on Android
2 parents 8ec34e9 + ee0cebe commit 5c0b0e9

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

drivers/unix/file_access_unix.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,17 @@ uint64_t FileAccessUnix::_get_modified_time(const String &p_file) {
340340
int err = stat(file.utf8().get_data(), &status);
341341

342342
if (!err) {
343-
return status.st_mtime;
343+
uint64_t modified_time = status.st_mtime;
344+
#ifdef ANDROID_ENABLED
345+
// Workaround for GH-101007
346+
//FIXME: After saving, all timestamps (st_mtime, st_ctime, st_atime) are set to the same value.
347+
// After exporting or after some time, only 'modified_time' resets to a past timestamp.
348+
uint64_t created_time = status.st_ctime;
349+
if (modified_time < created_time) {
350+
modified_time = created_time;
351+
}
352+
#endif
353+
return modified_time;
344354
} else {
345355
return 0;
346356
}

0 commit comments

Comments
 (0)