io_win32: use try_func when dispatching mapped_file

This commit is contained in:
Danny Robson 2018-08-14 16:48:20 +10:00
parent d8f916a25b
commit 2eb1f2b919

View File

@ -110,24 +110,27 @@ mapped_file::mapped_file (::cruft::win32::handle &&src,
//-----------------------------------------------------------------------------
mapped_file::mapped_file (const std::experimental::filesystem::path &path,
int fflags,
int mflags):
mapped_file (
::cruft::win32::handle (
::CreateFile (
path.string ().c_str (),
fflags_to_generic (fflags),
fflags == O_RDONLY ? FILE_SHARE_READ : 0,
nullptr,
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN,
nullptr
)
),
fflags,
mflags
)
mapped_file::mapped_file (
std::experimental::filesystem::path const &path,
int fflags,
int mflags
)
: mapped_file (
::cruft::win32::handle (
::cruft::win32::error::try_call (
::CreateFile,
path.u8string ().c_str (),
fflags_to_generic (fflags),
fflags == O_RDONLY ? FILE_SHARE_READ : 0,
nullptr,
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN,
nullptr
)
),
fflags,
mflags
)
{ ; }