From dcccba655fe848564e961b3f285ce3a82d3ac73a Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Sat, 7 Mar 2020 14:07:28 +0300 Subject: Add more support for symlinks on Windows See mksymlink() for details of the symlinks support on Windows. --- libbutl/win32-utility.ixx | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 libbutl/win32-utility.ixx (limited to 'libbutl/win32-utility.ixx') diff --git a/libbutl/win32-utility.ixx b/libbutl/win32-utility.ixx new file mode 100644 index 0000000..403d986 --- /dev/null +++ b/libbutl/win32-utility.ixx @@ -0,0 +1,32 @@ +// file : libbutl/win32-utility.ixx -*- C++ -*- +// license : MIT; see accompanying LICENSE file + +namespace butl +{ + namespace win32 + { + inline void auto_handle:: + reset (HANDLE h) noexcept + { + // Don't check for an error as not much we can do here. + // + if (handle_ != INVALID_HANDLE_VALUE) + CloseHandle (handle_); + + handle_ = h; + } + + inline auto_handle& auto_handle:: + operator= (auto_handle&& h) noexcept + { + reset (h.release ()); + return *this; + } + + inline auto_handle:: + ~auto_handle () noexcept + { + reset (); + } + } +} -- cgit v1.1