diff options
author | danlark <danlark@yandex-team.ru> | 2022-02-10 16:46:10 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:10 +0300 |
commit | baa58daefa91fde4b4769facdbd2903763b9c6a8 (patch) | |
tree | 1a2c5ffcf89eb53ecd79dbc9bc0a195c27404d0c /util/folder/path.cpp | |
parent | 3426a9bc7f169ae9da54cef557ad2a33f6e8eee0 (diff) | |
download | ydb-baa58daefa91fde4b4769facdbd2903763b9c6a8.tar.gz |
Restoring authorship annotation for <danlark@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'util/folder/path.cpp')
-rw-r--r-- | util/folder/path.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/util/folder/path.cpp b/util/folder/path.cpp index 0d5400fd14..bfe0c67d68 100644 --- a/util/folder/path.cpp +++ b/util/folder/path.cpp @@ -93,11 +93,11 @@ TFsPath TFsPath::RelativePath(const TFsPath& root) const { for (size_t i = 0; i < rsplit.size() - cnt; i++) { r += i == 0 ? ".." : "/.."; } - for (size_t i = cnt; i < split.size(); i++) { - r += (i == 0 || i == cnt && rsplit.size() - cnt == 0 ? "" : "/"); + for (size_t i = cnt; i < split.size(); i++) { + r += (i == 0 || i == cnt && rsplit.size() - cnt == 0 ? "" : "/"); r += split[i]; } - return r.size() ? TFsPath(r) : TFsPath(); + return r.size() ? TFsPath(r) : TFsPath(); } TFsPath TFsPath::Parent() const { @@ -230,7 +230,7 @@ struct TClosedir { void TFsPath::ListNames(TVector<TString>& children) const { CheckDefined(); - THolder<DIR, TClosedir> dir(opendir(this->c_str())); + THolder<DIR, TClosedir> dir(opendir(this->c_str())); if (!dir) { ythrow TIoSystemError() << "failed to opendir " << Path_; } @@ -340,15 +340,15 @@ void TFsPath::CheckExists() const { } bool TFsPath::IsDirectory() const { - return IsDefined() && TFileStat(GetPath().data()).IsDir(); + return IsDefined() && TFileStat(GetPath().data()).IsDir(); } bool TFsPath::IsFile() const { - return IsDefined() && TFileStat(GetPath().data()).IsFile(); + return IsDefined() && TFileStat(GetPath().data()).IsFile(); } bool TFsPath::IsSymlink() const { - return IsDefined() && TFileStat(GetPath().data(), true).IsSymlink(); + return IsDefined() && TFileStat(GetPath().data(), true).IsSymlink(); } void TFsPath::DeleteIfExists() const { @@ -356,8 +356,8 @@ void TFsPath::DeleteIfExists() const { return; } - ::unlink(this->c_str()); - ::rmdir(this->c_str()); + ::unlink(this->c_str()); + ::rmdir(this->c_str()); if (Exists()) { ythrow TIoException() << "failed to delete " << Path_; } @@ -366,7 +366,7 @@ void TFsPath::DeleteIfExists() const { void TFsPath::MkDir(const int mode) const { CheckDefined(); if (!Exists()) { - int r = Mkdir(this->c_str(), mode); + int r = Mkdir(this->c_str(), mode); if (r != 0) { // TODO (stanly) will still fail on Windows because // LastSystemError() returns windows specific ERROR_ALREADY_EXISTS |