Merge pull request #2 from csg2008/branch-qt-5.15

Enhance the function to check whether the file exists, support large files
This commit is contained in:
xiaoyifang 2022-01-15 15:45:43 +08:00 committed by GitHub
commit 9437025179
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -68,10 +68,18 @@ void loadFromFile( std::string const & n, std::vector< char > & data )
bool exists( char const * filename ) throw()
{
#ifdef __WIN32
#if defined(__WIN64) || defined(_MSC_VER)
struct _stat64 buf;
#else
struct _stat buf;
#endif
wchar_t wname[16384];
MultiByteToWideChar( CP_UTF8, 0, filename, -1, wname, 16384 );
#if defined(__WIN64) || defined(_MSC_VER)
return _wstat64( wname, &buf ) == 0;
#else
return _wstat( wname, &buf ) == 0;
#endif
#else
struct stat buf;