MCPcopy Create free account
hub / github.com/SFML/SFML / getAttributes

Method getAttributes

src/SFML/Network/Sftp.cpp:904–927  ·  view source on GitHub ↗

///////////////////////////////////////////////////////

Source from the content-addressed store, hash-verified

902
903////////////////////////////////////////////////////////////
904Sftp::AttributesResult Sftp::getAttributes(const std::filesystem::path& path, bool followLinks, const TimeoutWithPredicate& timeout)
905{
906 LIBSSH2_SFTP_ATTRIBUTES attributes{};
907
908 const auto pathString = pathToUtf8(path);
909 const auto result = m_impl->waitForOperationComplete(
910 [&]
911 {
912 return libssh2_sftp_stat_ex(m_impl->sftpSession.get(),
913 pathString.data(),
914 static_cast<unsigned int>(pathString.size()),
915 followLinks ? LIBSSH2_SFTP_STAT : LIBSSH2_SFTP_LSTAT,
916 &attributes);
917 },
918 timeout);
919
920 if (result == LIBSSH2_ERROR_EAGAIN)
921 return {Result(Result::Value::Timeout), {}};
922
923 if (result < 0)
924 return {makeError(m_impl->ssh2Session.get(), m_impl->sftpSession.get()), {}};
925
926 return {Result(Result::Value::Success), makeAttributes(pathString, attributes)};
927}
928
929
930////////////////////////////////////////////////////////////

Callers 2

Sftp.test.cppFile · 0.80
mainFunction · 0.80

Calls 5

pathToUtf8Function · 0.85
makeErrorFunction · 0.85
makeAttributesFunction · 0.85
getMethod · 0.80

Tested by

no test coverage detected