ENH: use access over stat for performance

This commit is contained in:
Bill Hoffman 2004-01-12 13:53:46 -05:00
parent b4bf41434c
commit e5bcc9244b

View File

@ -37,6 +37,9 @@
#endif #endif
#if defined(_WIN32) && (defined(_MSC_VER) || defined(__BORLANDC__) || defined(__MINGW32__)) #if defined(_WIN32) && (defined(_MSC_VER) || defined(__BORLANDC__) || defined(__MINGW32__))
#include <io.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h> #include <string.h>
#include <windows.h> #include <windows.h>
#include <direct.h> #include <direct.h>
@ -626,8 +629,10 @@ bool SystemTools::SameFile(const char* file1, const char* file2)
// return true if the file exists // return true if the file exists
bool SystemTools::FileExists(const char* filename) bool SystemTools::FileExists(const char* filename)
{ {
// struct stat fs; #ifdef _MSC_VER
// if (stat(filename, &fs) != 0) # define access _access
# define F_OK 0
#endif
if ( access(filename, F_OK) != 0 ) if ( access(filename, F_OK) != 0 )
{ {
return false; return false;