| |
11 |
11 |
|
| |
12 |
12 |
|
| |
13 |
13 |
|
| |
14 |
14 |
|
| |
15 |
15 |
|
| |
16 |
16 |
|
| |
17 |
17 |
|
| |
18 |
18 |
|
| |
19 |
19 |
#include "stdafx.h" |
| |
20 |
20 |
#include "TLocalFilesystemFile.h" |
| |
21 |
21 |
#include "TBufferSizes.h" |
| |
22 |
22 |
#include "TCoreException.h" |
| |
23 |
23 |
#include "ErrorCodes.h" |
| |
24 |
24 |
#include <boost/numeric/conversion/cast.hpp> |
| |
25 |
25 |
#include "RoundingFunctions.h" |
| |
26 |
26 |
#include "TLocalFilesystem.h" |
| |
27 |
27 |
#include "TFileException.h" |
| |
28 |
28 |
#include "TFileInfo.h" |
| |
29 |
29 |
#include "StreamingHelpers.h" |
| |
30 |
30 |
#include "TOverlappedDataBufferQueue.h" |
| |
|
31 |
#include "OverlappedCallbacks.h" |
| |
31 |
32 |
|
| |
32 |
33 |
namespace chcore |
| |
33 |
34 |
{ |
| |
34 |
35 |
|
| |
35 |
36 |
static_assert(TLocalFilesystemFile::MaxSectorSize <= TBufferSizes::BufferGranularity, "Buffer granularity must be equal to or bigger than the max sector size"); |
| |
36 |
37 |
|
| |
37 |
38 |
TLocalFilesystemFile::TLocalFilesystemFile(const TSmartPath& pathFile, bool bNoBuffering, const logger::TLogFileDataPtr& spLogFileData) : |
| |
38 |
39 |
m_pathFile(TLocalFilesystem::PrependPathExtensionIfNeeded(pathFile)), |
| |
39 |
40 |
m_hFile(INVALID_HANDLE_VALUE), |
| |
40 |
41 |
m_bNoBuffering(bNoBuffering), |
| |
41 |
42 |
m_spLog(logger::MakeLogger(spLogFileData, L"Filesystem-File")) |
| |
42 |
43 |
{ |
| |
43 |
44 |
if (pathFile.IsEmpty()) |
| |
44 |
45 |
throw TCoreException(eErr_InvalidArgument, L"pathFile", LOCATION); |
| |
45 |
46 |
} |
| |
46 |
47 |
|
| |
47 |
48 |
TLocalFilesystemFile::~TLocalFilesystemFile() |
| |
48 |
49 |
{ |
| |
49 |
50 |
try |
| |
50 |
51 |
{ |