diff options
author | danlark <danlark@yandex-team.ru> | 2022-02-10 16:46:08 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:08 +0300 |
commit | 3426a9bc7f169ae9da54cef557ad2a33f6e8eee0 (patch) | |
tree | 26154e1e9990f1bb4525d3e3fb5b6dac2c2c1da2 /util/folder/path.cpp | |
parent | cb68f224c46a8ee52ac3fdd2a32534b8bb8dc134 (diff) | |
download | ydb-3426a9bc7f169ae9da54cef557ad2a33f6e8eee0.tar.gz |
Restoring authorship annotation for <danlark@yandex-team.ru>. Commit 1 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 bfe0c67d68..0d5400fd14 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 |