我有这段代码来检查路径是目录还是文件。它适用于FTP,但不适用于SFTP。如何检查路径是否是目录不是libcurl文件?
bool IsDir(const wxString& path)
{
wxString fullRemotePath = "sftp://user@server/home/user/";
curl_easy_setopt(m_ftp, CURLOPT_URL, fullRemotePath.c_str().AsChar());
curl_easy_setopt(m_ftp, CURLOPT_NOBODY, 1L);//No transfer
m_rc = curl_easy_perform(m_ftp);
//reset back to normal
curl_easy_setopt(m_ftp, CURLOPT_NOBODY, 0L);
return m_rc == CURLE_OK; //I expected it to fail on file, but it does not
}
卷曲版本为curl-7.43.0