13 #ifndef __STOUT_INTERNAL_WINDOWS_SYMLINK_HPP__
14 #define __STOUT_INTERNAL_WINDOWS_SYMLINK_HPP__
34 ::GetFullPathNameW(
longpath(path).data(), 0,
nullptr,
nullptr);
37 return WindowsError(
"Failed to retrieve fullpath buffer size");
40 std::vector<wchar_t> buffer;
41 buffer.reserve(static_cast<size_t>(length));
44 ::GetFullPathNameW(
longpath(path).data(), length, buffer.data(),
nullptr);
83 if (!absolute_path.
isSome()) {
93 if (is_reparse_point.
isError()) {
95 }
else if (!is_reparse_point.
get()) {
97 "Reparse point attribute is not set for path '" + absolute_path.
get() +
98 "', and therefore it is not a symbolic link");
104 if (symlink_handle.
isError()) {
115 #endif // __STOUT_INTERNAL_WINDOWS_SYMLINK_HPP__
Result< std::string > fullpath(const std::string &path)
Definition: symlink.hpp:30
Try< SharedHandle > get_handle_no_follow(const std::string &absolute_path)
Definition: reparsepoint.hpp:212
Definition: errorbase.hpp:35
HANDLE get_handle() const
Definition: windows.hpp:96
static Result< T > error(const std::string &message)
Definition: result.hpp:53
Definition: error.hpp:106
Try< SymbolicLink > query_symbolic_link_data(const std::string &path)
Definition: symlink.hpp:79
Try< bool > reparse_point_attribute_set(const std::wstring &absolute_path)
Definition: reparsepoint.hpp:111
Definition: result.hpp:40
std::string remove(const std::string &from, const std::string &substring, Mode mode=ANY)
Definition: strings.hpp:40
Try< SymbolicLink > get_symbolic_link_data(const HANDLE handle)
Definition: reparsepoint.hpp:265
const T & get() const
Definition: result.hpp:115
static Try error(const E &e)
Definition: try.hpp:42
bool isError() const
Definition: try.hpp:71
bool isSome() const
Definition: result.hpp:111
std::wstring longpath(const std::string &path)
Definition: longpath.hpp:38
std::string stringify(int flags)
const T & get() const
Definition: try.hpp:73