diff --git a/SystemTools.cxx b/SystemTools.cxx index 0714344cf2b5efc2afe4e306364bda475a65452d..7eecde7d04f950add01d59411682863c590abba4 100644 --- a/SystemTools.cxx +++ b/SystemTools.cxx @@ -1233,13 +1233,11 @@ bool SystemTools::FileExists(const kwsys_stl::string& filename) //---------------------------------------------------------------------------- bool SystemTools::FileExists(const char* filename, bool isFile) { - if(SystemTools::FileExists(filename)) + if(!filename) { - // If isFile is set return not FileIsDirectory, - // so this will only be true if it is a file - return !isFile || !SystemTools::FileIsDirectory(filename); + return false; } - return false; + return SystemTools::FileExists(kwsys_stl::string(filename), isFile); } //---------------------------------------------------------------------------- diff --git a/SystemTools.hxx.in b/SystemTools.hxx.in index 79cac1d5fac9f744d6b46674ae7962083688773f..ca22b6c192c16c3bb959b5a145ab85954af0355d 100644 --- a/SystemTools.hxx.in +++ b/SystemTools.hxx.in @@ -292,7 +292,9 @@ public: * Return true if a file exists in the current directory. * If isFile = true, then make sure the file is a file and * not a directory. If isFile = false, then return true - * if it is a file or a directory. + * if it is a file or a directory. Note that the file will + * also be checked for read access. (Currently, this check + * for read access is only done on POSIX systems.) */ static bool FileExists(const char* filename, bool isFile); static bool FileExists(const kwsys_stl::string& filename, bool isFile);