diff options
author | Reinhard Tartler <siretart@tauware.de> | 2017-06-14 20:31:59 -0400 |
---|---|---|
committer | Reinhard Tartler <siretart@tauware.de> | 2017-06-14 20:31:59 -0400 |
commit | 3d41f38641b5f1a44bfda5da2979abb826b0010a (patch) | |
tree | a7eab35d537e7327941b4c90492e96171b1600ab /lib/common/FileStream.cpp | |
parent | b27a94ec5fa429bb9f45bd78fcce7cda9ab15af6 (diff) | |
parent | cf52058f32e54fe720abe51d8d5266b440180163 (diff) |
Merge commit 'cf52058f'
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) } |