13 #ifndef __STOUT_OS_WINDOWS_REALPATH_HPP__
14 #define __STOUT_OS_WINDOWS_REALPATH_HPP__
41 DWORD length = ::GetFinalPathNameByHandleW(
44 return WindowsError(
"Failed to retrieve realpath buffer size");
47 std::vector<wchar_t> buffer;
48 buffer.reserve(static_cast<size_t>(length));
50 DWORD result = ::GetFinalPathNameByHandleW(
51 handle.
get().
get_handle(), buffer.data(), length, FILE_NAME_NORMALIZED);
65 #endif // __STOUT_OS_WINDOWS_REALPATH_HPP__
Definition: errorbase.hpp:35
HANDLE get_handle() const
Definition: windows.hpp:96
Result< std::string > realpath(const std::string &path)
Definition: realpath.hpp:24
Definition: error.hpp:106
Definition: result.hpp:40
std::string remove(const std::string &from, const std::string &substring, Mode mode=ANY)
Definition: strings.hpp:40
static Try error(const E &e)
Definition: try.hpp:42
Try< SharedHandle > get_handle_follow(const std::string &absolute_path)
Definition: reparsepoint.hpp:155
bool isError() const
Definition: try.hpp:71
std::string stringify(int flags)
const T & get() const
Definition: try.hpp:73