diff options
Diffstat (limited to 'lib/common/FileStream.cpp')
-rw-r--r-- | lib/common/FileStream.cpp | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/lib/common/FileStream.cpp b/lib/common/FileStream.cpp index fc0319da..51752f85 100644 --- a/lib/common/FileStream.cpp +++ b/lib/common/FileStream.cpp @@ -67,22 +67,29 @@ void FileStream::AfterOpen() { MEMLEAKFINDER_NOT_A_LEAK(this); - #ifdef WIN32 - BOX_LOG_WIN_WARNING_NUMBER("Failed to open file: " << - mFileName, winerrno); - #else - BOX_LOG_SYS_WARNING("Failed to open file: " << - mFileName); - #endif - +#ifdef WIN32 + if(errno == EACCES) + { + THROW_WIN_FILE_ERRNO("Failed to open file", mFileName, + winerrno, CommonException, AccessDenied); + } + else + { + THROW_WIN_FILE_ERRNO("Failed to open file", mFileName, + winerrno, CommonException, OSFileOpenError); + } +#else if(errno == EACCES) { - THROW_EXCEPTION(CommonException, AccessDenied) + THROW_SYS_FILE_ERROR("Failed to open file", mFileName, + CommonException, AccessDenied); } else { - THROW_EXCEPTION(CommonException, OSFileOpenError) + THROW_SYS_FILE_ERROR("Failed to open file", mFileName, + CommonException, OSFileOpenError); } +#endif } } @@ -244,9 +251,9 @@ IOStream::pos_type FileStream::BytesLeftToRead() // Created: 2003/07/31 // // -------------------------------------------------------------------------- -void FileStream::Write(const void *pBuffer, int NBytes) +void FileStream::Write(const void *pBuffer, int NBytes, int Timeout) { - if(mOSFileHandle == INVALID_FILE) + if(mOSFileHandle == INVALID_FILE) { THROW_EXCEPTION(CommonException, FileClosed) } |