MCPcopy Create free account
hub / github.com/Kitware/CMake / ReadSymlink

Method ReadSymlink

Source/cmPathResolver.cxx:205–227  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

203#endif
204
205cm::optional<std::string> ImplBase::ReadSymlink(std::string const& path,
206 cmsys::Status& status)
207{
208 cm::optional<std::string> result;
209 std::string target;
210 status = this->OS.ReadSymlink(path, target);
211 if (status && ++this->SymlinkDepth >= MAX_SYMBOLIC_LINKS) {
212 status = cmsys::Status::POSIX(ELOOP);
213 }
214 if (status) {
215 if (!target.empty()) {
216 result = std::move(target);
217 }
218 } else if (status.GetPOSIX() == EINVAL
219#ifdef _WIN32
220 || status.GetWindows() == ERROR_NOT_A_REPARSE_POINT
221#endif
222 ) {
223 // The path was not a symlink.
224 status = cmsys::Status::Success();
225 }
226 return result;
227}
228
229Control ImplBase::ResolveSymlink(Root root, std::string::size_type slash,
230 std::string::size_type next_slash,

Callers 1

ResolveComponentMethod · 0.45

Calls 2

moveFunction · 0.85
emptyMethod · 0.45

Tested by

no test coverage detected