Esempio n. 1
0
void* GetDirectory(VFSURL* url, VFSDirEntry** items,
                   int* num_items, VFSCallbacks* callbacks)
{
  std::vector<VFSDirEntry>* result = new std::vector<VFSDirEntry>;
  CSFTPSessionPtr session = CSFTPSessionManager::Get().CreateSession(url);
  std::stringstream str;
  str << "sftp://" << url->username << ":" << url->password
      << "@" << url->hostname << ":" << url->port << "/";
  if (!session->GetDirectory(str.str(), url->filename, *result))
  {
    delete result;
    return NULL;
  }

  if (result->size())
    *items = &(*result)[0];
  *num_items = result->size();

  return result;
}