| 64 | }; |
| 65 | |
| 66 | inline TDirIterator(const TString& path, const TOptions& options = TOptions()) |
| 67 | : Options_(options) |
| 68 | , Path_(path) |
| 69 | { |
| 70 | Trees_[0] = Path_.begin(); |
| 71 | Trees_[1] = nullptr; |
| 72 | |
| 73 | FileTree_.Reset(yfts_open(Trees_, Options_.FtsOptions, Options_.Cmp)); |
| 74 | |
| 75 | if (!FileTree_.Get() || FileTree_->fts_cur->fts_link->fts_errno) { |
| 76 | ythrow TError(FileTree_.Get() ? FileTree_->fts_cur->fts_link->fts_errno : LastSystemError()) << "can not open '" << Path_ << "'"; |
| 77 | } |
| 78 | } |
| 79 | |
| 80 | inline FTSENT* Next() { |
| 81 | FTSENT* ret = yfts_read(FileTree_.Get()); |