aboutsummaryrefslogtreecommitdiffstats
path: root/util/folder/path.cpp
diff options
context:
space:
mode:
authorkikht <kikht@yandex-team.ru>2022-02-10 16:45:14 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:45:14 +0300
commit778e51ba091dc39e7b7fcab2b9cf4dbedfb6f2b5 (patch)
treebe835aa92c6248212e705f25388ebafcf84bc7a1 /util/folder/path.cpp
parent194cae0e8855b11be2005e1eff12c660c3ee9774 (diff)
downloadydb-778e51ba091dc39e7b7fcab2b9cf4dbedfb6f2b5.tar.gz
Restoring authorship annotation for <kikht@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'util/folder/path.cpp')
-rw-r--r--util/folder/path.cpp56
1 files changed, 28 insertions, 28 deletions
diff --git a/util/folder/path.cpp b/util/folder/path.cpp
index 256940d96d..bfe0c67d68 100644
--- a/util/folder/path.cpp
+++ b/util/folder/path.cpp
@@ -387,39 +387,39 @@ void TFsPath::MkDirs(const int mode) const {
}
void TFsPath::ForceDelete() const {
- if (!IsDefined()) {
- return;
- }
-
- TFileStat stat(GetPath().c_str(), true);
- if (stat.IsNull()) {
- const int err = LastSystemError();
-#ifdef _win_
- if (err == ERROR_FILE_NOT_FOUND || err == ERROR_PATH_NOT_FOUND) {
-#else
- if (err == ENOENT) {
-#endif
- return;
- } else {
- ythrow TIoException() << "failed to stat " << Path_;
- }
- }
-
- ClearLastSystemError();
- if (stat.IsDir()) {
+ if (!IsDefined()) {
+ return;
+ }
+
+ TFileStat stat(GetPath().c_str(), true);
+ if (stat.IsNull()) {
+ const int err = LastSystemError();
+#ifdef _win_
+ if (err == ERROR_FILE_NOT_FOUND || err == ERROR_PATH_NOT_FOUND) {
+#else
+ if (err == ENOENT) {
+#endif
+ return;
+ } else {
+ ythrow TIoException() << "failed to stat " << Path_;
+ }
+ }
+
+ ClearLastSystemError();
+ if (stat.IsDir()) {
TVector<TFsPath> children;
List(children);
for (auto& i : children) {
i.ForceDelete();
}
- ::rmdir(this->c_str());
- } else {
- ::unlink(this->c_str());
- }
-
- if (LastSystemError()) {
- ythrow TIoException() << "failed to delete " << Path_;
- }
+ ::rmdir(this->c_str());
+ } else {
+ ::unlink(this->c_str());
+ }
+
+ if (LastSystemError()) {
+ ythrow TIoException() << "failed to delete " << Path_;
+ }
}
void TFsPath::CopyTo(const TString& newPath, bool force) const {