From 8743712223e23a917b1d21e2a53e582d67fa47ca Mon Sep 17 00:00:00 2001 From: Charlie Fenton Date: Wed, 16 Apr 2008 09:04:12 +0000 Subject: [PATCH] Fix is_file() and is_dir() to compile properly on Windows. svn path=/trunk/boinc/; revision=15064 --- checkin_notes | 7 +++++++ lib/filesys.C | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/checkin_notes b/checkin_notes index b9dbdd985c..76a1bfb53a 100644 --- a/checkin_notes +++ b/checkin_notes @@ -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 diff --git a/lib/filesys.C b/lib/filesys.C index 2893c27083..79f8b75004 100644 --- a/lib/filesys.C +++ b/lib/filesys.C @@ -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