Fix is_file() and is_dir() to compile properly on Windows.

svn path=/trunk/boinc/; revision=15064
This commit is contained in:
Charlie Fenton 2008-04-16 09:04:12 +00:00
parent 8a3f4dc1e5
commit 8743712223
2 changed files with 9 additions and 2 deletions

View File

@ -3271,3 +3271,10 @@ Charlie April 15 2008
lib/
filesys.C
Charlie April 16 2008
- Fix is_file() and is_dir() to compile properly on Windows by using
the actual expressions instead of the macros which aren't defined.
lib/
filesys.C

View File

@ -79,13 +79,13 @@ char boinc_failed_file[256];
int is_file(const char* path) {
struct stat sbuf;
int retval = stat(path, &sbuf);
return (!retval && S_ISREG(sbuf.st_mode));
return (!retval && (((sbuf.st_mode) & S_IFMT) == S_IFREG));
}
int is_dir(const char* path) {
struct stat sbuf;
int retval = stat(path, &sbuf);
return (!retval && S_ISDIR(sbuf.st_mode));
return (!retval && (((sbuf.st_mode) & S_IFMT) == S_IFDIR));
}
#ifndef _WIN32