///////////////////////////////////////////////////////
| 902 | |
| 903 | //////////////////////////////////////////////////////////// |
| 904 | Sftp::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 | //////////////////////////////////////////////////////////// |
no test coverage detected