mirror of https://github.com/BOINC/boinc.git
Lib: fix bug for apps built with VS2015 running on WinXP
for boinc_file_exists(), use GetFileAttributesA(). _stat64() doesn't work in this case
This commit is contained in:
parent
624595267c
commit
bbd34f70d3
|
@ -526,19 +526,23 @@ FILE* boinc_fopen(const char* path, const char* mode) {
|
|||
return f;
|
||||
}
|
||||
|
||||
|
||||
int boinc_file_exists(const char* path) {
|
||||
#ifdef _WIN32
|
||||
struct __stat64 buf;
|
||||
if (_stat64(path, &buf)) {
|
||||
int boinc_file_exists(const char* path) {
|
||||
// don't use _stat64 because it doesn't work with VS2015, XP client
|
||||
DWORD dwAttrib = GetFileAttributesA(path);
|
||||
return (dwAttrib != INVALID_FILE_ATTRIBUTES
|
||||
&& !(dwAttrib & FILE_ATTRIBUTE_DIRECTORY)
|
||||
);
|
||||
}
|
||||
#else
|
||||
int boinc_file_exists(const char* path) {
|
||||
struct stat buf;
|
||||
if (stat(path, &buf)) {
|
||||
#endif
|
||||
return false; // stat() returns zero on success
|
||||
}
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
// same, but doesn't traverse symlinks
|
||||
//
|
||||
|
|
Loading…
Reference in New Issue