From f17d4347692599434d360cd7b81eaa902a55b4c5 Mon Sep 17 00:00:00 2001 From: Jeffrey Pfau Date: Wed, 15 Jun 2016 22:46:24 -0700 Subject: [PATCH] VFS: VFile.sync now updates modified time --- CHANGES | 1 + src/util/vfs/vfs-fd.c | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index 6ff29987f..91eee9769 100644 --- a/CHANGES +++ b/CHANGES @@ -35,6 +35,7 @@ Misc: - Qt: Canonicalize file paths when loading games - Qt: Add refresh button to controller editing - Debugger: CLI debugger now exits when end-of-stream is reached + - VFS: VFile.sync now updates modified time 0.4.0: (2016-02-02) Features: diff --git a/src/util/vfs/vfs-fd.c b/src/util/vfs/vfs-fd.c index 59aa0706d..ec8abfb09 100644 --- a/src/util/vfs/vfs-fd.c +++ b/src/util/vfs/vfs-fd.c @@ -9,6 +9,7 @@ #include #ifndef _WIN32 #include +#include #else #include #endif @@ -159,8 +160,15 @@ static bool _vfdSync(struct VFile* vf, const void* buffer, size_t size) { UNUSED(size); struct VFileFD* vfd = (struct VFileFD*) vf; #ifndef _WIN32 + futimes(vfd->fd, NULL); return fsync(vfd->fd) == 0; #else - return FlushFileBuffers((HANDLE) _get_osfhandle(vfd->fd)); + HANDLE h = (HANDLE) _get_osfhandle(vfd->fd); + FILETIME ft; + SYSTEMTIME st; + GetSystemTime(&st); + SystemTimeToFileTime(&st, &ft); + SetFileTime(h, NULL, &ft, &ft); + return FlushFileBuffers(h); #endif }