mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-11 15:22:15 +00:00
- Worked around issue where stat doesn't work in v140_xp. Even though the bug was supposedly fixed for awhile now it didn't make it into Update 1.
This commit is contained in:
parent
72d4c33453
commit
964ee6bb23
2 changed files with 38 additions and 0 deletions
|
@ -496,6 +496,11 @@ if( NOT MSVC )
|
|||
add_definitions( -D__forceinline=inline )
|
||||
endif( NOT MSVC )
|
||||
|
||||
# Fix stat in v140_xp (broken in RTM and Update 1 so far)
|
||||
if( MSVC AND MSVC_VERSION EQUAL 1900 AND CMAKE_GENERATOR_TOOLSET STREQUAL "v140_xp" )
|
||||
add_definitions( -D_stat64i32=VS14Stat )
|
||||
endif( MSVC AND MSVC_VERSION EQUAL 1900 AND CMAKE_GENERATOR_TOOLSET STREQUAL "v140_xp" )
|
||||
|
||||
if( UNIX )
|
||||
CHECK_LIBRARY_EXISTS( rt clock_gettime "" CLOCK_GETTIME_IN_RT )
|
||||
if( NOT CLOCK_GETTIME_IN_RT )
|
||||
|
|
|
@ -1726,3 +1726,36 @@ FString I_GetLongPathName(FString shortpath)
|
|||
delete[] buff;
|
||||
return longpath;
|
||||
}
|
||||
|
||||
#if _MSC_VER == 1900 && defined(_USING_V110_SDK71_)
|
||||
//==========================================================================
|
||||
//
|
||||
// VS14Stat
|
||||
//
|
||||
// Work around an issue where stat doesn't work with v140_xp. This was
|
||||
// supposedly fixed, but as of Update 1 continues to not function on XP.
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
#include <sys/stat.h>
|
||||
|
||||
int VS14Stat(const char *path, struct _stat64i32 *buffer)
|
||||
{
|
||||
WIN32_FILE_ATTRIBUTE_DATA data;
|
||||
if(!GetFileAttributesEx(path, GetFileExInfoStandard, &data))
|
||||
return -1;
|
||||
|
||||
buffer->st_ino = 0;
|
||||
buffer->st_mode = ((data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) ? S_IFDIR : S_IFREG)|
|
||||
((data.dwFileAttributes & FILE_ATTRIBUTE_READONLY) ? S_IREAD : S_IREAD|S_IWRITE);
|
||||
buffer->st_dev = buffer->st_rdev = 0;
|
||||
buffer->st_nlink = 1;
|
||||
buffer->st_uid = 0;
|
||||
buffer->st_gid = 0;
|
||||
buffer->st_size = data.nFileSizeLow;
|
||||
buffer->st_atime = (*(QWORD*)&data.ftLastAccessTime) / 10000000 - 11644473600LL;
|
||||
buffer->st_mtime = (*(QWORD*)&data.ftLastWriteTime) / 10000000 - 11644473600LL;
|
||||
buffer->st_ctime = (*(QWORD*)&data.ftCreationTime) / 10000000 - 11644473600LL;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue