Return false instead of throwing an exception if file does not exist in isDirectory(), isFile(), canRead() and canWrite().

This commit is contained in:
Vincent Richard 2010-03-16 08:39:45 +00:00
parent 3604182a9a
commit 2854eed183

View File

@ -306,6 +306,9 @@ bool posixFile::isFile() const
if (::stat(m_nativePath.c_str(), &buf) == -1)
{
if (errno == ENOENT)
return false;
posixFileSystemFactory::reportError(m_path, errno);
return false;
}
@ -320,6 +323,9 @@ bool posixFile::isDirectory() const
if (::stat(m_nativePath.c_str(), &buf) == -1)
{
if (errno == ENOENT)
return false;
posixFileSystemFactory::reportError(m_path, errno);
return false;
}
@ -334,6 +340,9 @@ bool posixFile::canRead() const
if (::stat(m_nativePath.c_str(), &buf) == -1)
{
if (errno == ENOENT)
return false;
posixFileSystemFactory::reportError(m_path, errno);
return false;
}
@ -349,6 +358,9 @@ bool posixFile::canWrite() const
if (::stat(m_nativePath.c_str(), &buf) == -1)
{
if (errno == ENOENT)
return false;
posixFileSystemFactory::reportError(m_path, errno);
return false;
}