diff options
author | Vincent Richard <[email protected]> | 2010-03-16 08:39:45 +0000 |
---|---|---|
committer | Vincent Richard <[email protected]> | 2010-03-16 08:39:45 +0000 |
commit | 2854eed1831bb05d3d8a9e7e7533b9af90419638 (patch) | |
tree | 7fb6b466df85b53982addc74cc876e3b0b0f7ab3 | |
parent | Fixed compilation issue with 'const'. (diff) | |
download | vmime-2854eed1831bb05d3d8a9e7e7533b9af90419638.tar.gz vmime-2854eed1831bb05d3d8a9e7e7533b9af90419638.zip |
Return false instead of throwing an exception if file does not exist in isDirectory(), isFile(), canRead() and canWrite().
-rw-r--r-- | src/platforms/posix/posixFile.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/platforms/posix/posixFile.cpp b/src/platforms/posix/posixFile.cpp index b814b758..ec529eb6 100644 --- a/src/platforms/posix/posixFile.cpp +++ b/src/platforms/posix/posixFile.cpp @@ -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; } |