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

Method RemoveRecursive

util/system/fs.cpp:45–72  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

43}
44
45void NFs::RemoveRecursive(const TString& path) {
46 static const TStringBuf errStr = "error while removing ";
47
48 if (!NFs::Exists(path)) {
49 return;
50 }
51
52 if (!TFileStat(path).IsDir()) {
53 if (!NFs::Remove(path)) {
54 ythrow TSystemError() << errStr << path << " with cwd (" << NFs::CurrentWorkingDirectory() << ")";
55 }
56 }
57
58 TDirIterator dir(path);
59
60 for (auto it = dir.begin(); it != dir.end(); ++it) {
61 switch (it->fts_info) {
62 case FTS_DOT:
63 case FTS_D:
64 break;
65 default:
66 if (!NFs::Remove(it->fts_path)) {
67 ythrow TSystemError() << errStr << it->fts_path << " with cwd (" << NFs::CurrentWorkingDirectory() << ")";
68 }
69 break;
70 }
71 }
72}
73
74bool NFs::MakeDirectory(const TString& path, EFilePermissions mode) {
75#if defined(_win_)

Callers

nothing calls this directly

Calls 4

TFileStatClass · 0.85
IsDirMethod · 0.80
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected