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
commit194cae0e8855b11be2005e1eff12c660c3ee9774 (patch)
treeed29c437b616690880c017855ebe0be34fdf81a2 /util/folder/path.cpp
parent49116032d905455a7b1c994e4a696afc885c1e71 (diff)
downloadydb-194cae0e8855b11be2005e1eff12c660c3ee9774.tar.gz
Restoring authorship annotation for <kikht@yandex-team.ru>. Commit 1 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 bfe0c67d68..256940d96d 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 {