VFS: VFile.sync now updates modified time

This commit is contained in:
Jeffrey Pfau 2016-06-15 22:46:24 -07:00
parent 6b1cbbd5e2
commit eb6cedde2e
2 changed files with 10 additions and 1 deletions

View File

@ -49,6 +49,7 @@ Misc:
- Qt: Add refresh button to controller editing - Qt: Add refresh button to controller editing
- ARM7: Clean up instruction decoding for future expandability - ARM7: Clean up instruction decoding for future expandability
- Debugger: CLI debugger now exits when end-of-stream is reached - Debugger: CLI debugger now exits when end-of-stream is reached
- VFS: VFile.sync now updates modified time
0.4.0: (2016-02-02) 0.4.0: (2016-02-02)
Features: Features:

View File

@ -9,6 +9,7 @@
#include <sys/stat.h> #include <sys/stat.h>
#ifndef _WIN32 #ifndef _WIN32
#include <sys/mman.h> #include <sys/mman.h>
#include <sys/time.h>
#else #else
#include <windows.h> #include <windows.h>
#endif #endif
@ -159,8 +160,15 @@ static bool _vfdSync(struct VFile* vf, const void* buffer, size_t size) {
UNUSED(size); UNUSED(size);
struct VFileFD* vfd = (struct VFileFD*) vf; struct VFileFD* vfd = (struct VFileFD*) vf;
#ifndef _WIN32 #ifndef _WIN32
futimes(vfd->fd, NULL);
return fsync(vfd->fd) == 0; return fsync(vfd->fd) == 0;
#else #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 #endif
} }