Exemple #1
0
 static svn_error_t*
 listEntriesFunc(void *baton, const char *path,
       const svn_dirent_t *dirent, const svn_lock_t *lock,
       const char *abs_path, apr_pool_t *pool)
 {
   if (!isEmpty(path))
   {
     DirEntries * entries = static_cast<DirEntries *>(baton);
     entries->push_back(
       DirEntry(path, const_cast<svn_dirent_t *>(dirent), lock));
   }
   return 0;
 }
void Directory::parseDir(const std::string& path)
{
    ::dirent* de = 0;
    ::DIR* dir = 0;

    this->clear();
    dir = ::opendir(path.c_str());
    if (dir == 0)
    {
        throw except::IOError(
                "Error opening directory '%s': %s",
                path.c_str(), except::getErrnoStr(
                        except::getErrno()).c_str());
    }

    while ((de = ::readdir(dir)) != 0)
    {
        this->_M_dirents.push_back(DirEntry(de->d_name,
                _S_getFileType(de->d_type)));
    }

    ::closedir(dir);
    this->_M_parsed = true;
}