diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2020-03-07 14:07:28 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2020-03-09 14:18:20 +0300 |
commit | dcccba655fe848564e961b3f285ce3a82d3ac73a (patch) | |
tree | 598ced3b406d80c23798672930e1a17cfe112b75 /libbutl/win32-utility.ixx | |
parent | 63b2988e4f2630cc688ff43b7e5f0d4f977896cd (diff) |
Add more support for symlinks on Windows
See mksymlink() for details of the symlinks support on Windows.
Diffstat (limited to 'libbutl/win32-utility.ixx')
-rw-r--r-- | libbutl/win32-utility.ixx | 32 |
1 files changed, 32 insertions, 0 deletions
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 (); + } + } +} |