From dfa48f4cc0829a5abb946c125653e168241f3345 Mon Sep 17 00:00:00 2001 From: Bill Hoffman <bill.hoffman@kitware.com> Date: Mon, 12 Jan 2004 13:53:46 -0500 Subject: [PATCH] ENH: use access over stat for performance --- SystemTools.cxx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/SystemTools.cxx b/SystemTools.cxx index 37556d7..661d651 100644 --- a/SystemTools.cxx +++ b/SystemTools.cxx @@ -37,6 +37,9 @@ #endif #if defined(_WIN32) && (defined(_MSC_VER) || defined(__BORLANDC__) || defined(__MINGW32__)) +#include <io.h> +#include <stdio.h> +#include <stdlib.h> #include <string.h> #include <windows.h> #include <direct.h> @@ -626,8 +629,10 @@ bool SystemTools::SameFile(const char* file1, const char* file2) // return true if the file exists bool SystemTools::FileExists(const char* filename) { -// struct stat fs; -// if (stat(filename, &fs) != 0) +#ifdef _MSC_VER +# define access _access +# define F_OK 0 +#endif if ( access(filename, F_OK) != 0 ) { return false; -- GitLab