MCPcopy Create free account
hub / github.com/catboost/catboost / ListNames

Method ListNames

util/folder/path.cpp:281–309  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

279};
280
281void TFsPath::ListNames(TVector<TString>& children) const {
282 CheckDefined();
283 THolder<DIR, TClosedir> dir(opendir(this->c_str()));
284 if (!dir) {
285 ythrow TIoSystemError() << "failed to opendir " << Path_;
286 }
287
288 for (;;) {
289 struct dirent de;
290 struct dirent* ok;
291 // TODO(yazevnul|IGNIETFERRO-1070): remove these macroses by replacing `readdir_r` with proper
292 // alternative
293 Y_PRAGMA_DIAGNOSTIC_PUSH
294 Y_PRAGMA_NO_DEPRECATED
295 int r = readdir_r(dir.Get(), &de, &ok);
296 Y_PRAGMA_DIAGNOSTIC_POP
297 if (r != 0) {
298 ythrow TIoSystemError() << "failed to readdir " << Path_;
299 }
300 if (ok == nullptr) {
301 return;
302 }
303 TString name(de.d_name);
304 if (name == "." || name == "..") {
305 continue;
306 }
307 children.push_back(name);
308 }
309}
310
311bool TFsPath::Contains(const TString& component) const {
312 if (!IsDefined()) {

Callers 2

Y_UNIT_TESTFunction · 0.80
Y_UNIT_TESTFunction · 0.80

Calls 5

c_strMethod · 0.95
opendirFunction · 0.85
readdir_rFunction · 0.85
GetMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected