diff options
author | Ruslan Kovalev <ruslan.a.kovalev@gmail.com> | 2022-02-10 16:46:45 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:45 +0300 |
commit | 9123176b341b6f2658cff5132482b8237c1416c8 (patch) | |
tree | 49e222ea1c5804306084bb3ae065bb702625360f /util/folder | |
parent | 59e19371de37995fcb36beb16cd6ec030af960bc (diff) | |
download | ydb-9123176b341b6f2658cff5132482b8237c1416c8.tar.gz |
Restoring authorship annotation for Ruslan Kovalev <ruslan.a.kovalev@gmail.com>. Commit 2 of 2.
Diffstat (limited to 'util/folder')
-rw-r--r-- | util/folder/dirent_win.h | 2 | ||||
-rw-r--r-- | util/folder/dirut.cpp | 2 | ||||
-rw-r--r-- | util/folder/dirut.h | 4 | ||||
-rw-r--r-- | util/folder/filelist.h | 2 | ||||
-rw-r--r-- | util/folder/iterator.h | 2 | ||||
-rw-r--r-- | util/folder/lstat_win.h | 2 | ||||
-rw-r--r-- | util/folder/path.cpp | 40 | ||||
-rw-r--r-- | util/folder/path.h | 10 |
8 files changed, 32 insertions, 32 deletions
diff --git a/util/folder/dirent_win.h b/util/folder/dirent_win.h index 449200333c..ac11a64c04 100644 --- a/util/folder/dirent_win.h +++ b/util/folder/dirent_win.h @@ -1,4 +1,4 @@ -#pragma once +#pragma once #include <util/system/defaults.h> diff --git a/util/folder/dirut.cpp b/util/folder/dirut.cpp index fa2c27bed6..ffc9b09f96 100644 --- a/util/folder/dirut.cpp +++ b/util/folder/dirut.cpp @@ -436,7 +436,7 @@ int MakeTempDir(char path[/*FILENAME_MAX*/], const char* prefix) { sysTmp = GetSystemTempDir(); prefix = sysTmp.data(); } - + if ((ret = ResolvePath(prefix, nullptr, path, 1)) != 0) return ret; if (!TFileStat(path).IsDir()) diff --git a/util/folder/dirut.h b/util/folder/dirut.h index 2f9f670d5a..2537027b12 100644 --- a/util/folder/dirut.h +++ b/util/folder/dirut.h @@ -1,4 +1,4 @@ -#pragma once +#pragma once #include <util/system/defaults.h> #include <util/system/sysstat.h> @@ -72,7 +72,7 @@ TString RealPath(const TString& path); // throws TString RealLocation(const TString& path); /// throws; last file name component doesn't need to exist TString GetSystemTempDir(); - + int MakeTempDir(char path[/*FILENAME_MAX*/], const char* prefix); int ResolvePath(const char* rel, const char* abs, char res[/*FILENAME_MAX*/], bool isdir = false); diff --git a/util/folder/filelist.h b/util/folder/filelist.h index 48cd9aceb9..3f615fa4c2 100644 --- a/util/folder/filelist.h +++ b/util/folder/filelist.h @@ -1,4 +1,4 @@ -#pragma once +#pragma once #include <util/generic/buffer.h> #include <util/generic/string.h> diff --git a/util/folder/iterator.h b/util/folder/iterator.h index 536b111dc1..69e025b9c4 100644 --- a/util/folder/iterator.h +++ b/util/folder/iterator.h @@ -1,4 +1,4 @@ -#pragma once +#pragma once #include "fts.h" diff --git a/util/folder/lstat_win.h b/util/folder/lstat_win.h index 7df2a6a74d..0bf7c19055 100644 --- a/util/folder/lstat_win.h +++ b/util/folder/lstat_win.h @@ -1,4 +1,4 @@ -#pragma once +#pragma once #include <util/system/defaults.h> #include "fts.h" diff --git a/util/folder/path.cpp b/util/folder/path.cpp index a29c9855fa..bfe0c67d68 100644 --- a/util/folder/path.cpp +++ b/util/folder/path.cpp @@ -68,7 +68,7 @@ TFsPath TFsPath::RelativeTo(const TFsPath& root) const { } if (!this->IsSubpathOf(root)) { - ythrow TIoException() << "path " << *this << " is not subpath of " << root; + ythrow TIoException() << "path " << *this << " is not subpath of " << root; } split.erase(split.begin(), split.begin() + rsplit.size()); @@ -121,9 +121,9 @@ TFsPath& TFsPath::operator/=(const TFsPath& that) { } else if (that.IsDefined() && that.GetPath() != ".") { if (!that.IsRelative()) { - ythrow TIoException() << "path should be relative: " << that.GetPath(); + ythrow TIoException() << "path should be relative: " << that.GetPath(); } - + TSplit split = GetSplit(); const TSplit& rsplit = that.GetSplit(); split.insert(split.end(), rsplit.begin(), rsplit.end()); @@ -212,7 +212,7 @@ TFsPath::TFsPath(const char* path) TFsPath TFsPath::Child(const TString& name) const { if (!name) { - ythrow TIoException() << "child name must not be empty"; + ythrow TIoException() << "child name must not be empty"; } return *this / name; @@ -222,7 +222,7 @@ struct TClosedir { static void Destroy(DIR* dir) { if (dir) { if (0 != closedir(dir)) { - ythrow TIoSystemError() << "failed to closedir"; + ythrow TIoSystemError() << "failed to closedir"; } } } @@ -232,7 +232,7 @@ void TFsPath::ListNames(TVector<TString>& children) const { CheckDefined(); THolder<DIR, TClosedir> dir(opendir(this->c_str())); if (!dir) { - ythrow TIoSystemError() << "failed to opendir " << Path_; + ythrow TIoSystemError() << "failed to opendir " << Path_; } for (;;) { @@ -245,7 +245,7 @@ void TFsPath::ListNames(TVector<TString>& children) const { int r = readdir_r(dir.Get(), &de, &ok); Y_PRAGMA_DIAGNOSTIC_POP if (r != 0) { - ythrow TIoSystemError() << "failed to readdir " << Path_; + ythrow TIoSystemError() << "failed to readdir " << Path_; } if (ok == nullptr) { return; @@ -319,16 +319,16 @@ TFsPath TFsPath::RealLocation() const { return ::RealLocation(*this); } -TFsPath TFsPath::ReadLink() const { - CheckDefined(); - +TFsPath TFsPath::ReadLink() const { + CheckDefined(); + if (!IsSymlink()) { - ythrow TIoException() << "not a symlink " << *this; + ythrow TIoException() << "not a symlink " << *this; } - + return NFs::ReadLink(*this); -} - +} + bool TFsPath::Exists() const { return IsDefined() && NFs::Exists(*this); } @@ -343,14 +343,14 @@ bool TFsPath::IsDirectory() const { return IsDefined() && TFileStat(GetPath().data()).IsDir(); } -bool TFsPath::IsFile() const { +bool TFsPath::IsFile() const { return IsDefined() && TFileStat(GetPath().data()).IsFile(); -} - -bool TFsPath::IsSymlink() const { +} + +bool TFsPath::IsSymlink() const { return IsDefined() && TFileStat(GetPath().data(), true).IsSymlink(); -} - +} + void TFsPath::DeleteIfExists() const { if (!IsDefined()) { return; diff --git a/util/folder/path.h b/util/folder/path.h index 1be66799da..2fb4d6b4ef 100644 --- a/util/folder/path.h +++ b/util/folder/path.h @@ -1,4 +1,4 @@ -#pragma once +#pragma once #include "fwd.h" #include "pathsplit.h" @@ -174,9 +174,9 @@ public: bool Exists() const; /// false if not exists bool IsDirectory() const; - /// false if not exists - bool IsFile() const; - /// false if not exists + /// false if not exists + bool IsFile() const; + /// false if not exists bool IsSymlink() const; /// throw TIoException if not exists void CheckExists() const; @@ -192,7 +192,7 @@ public: TFsPath RealPath() const; TFsPath RealLocation() const; - TFsPath ReadLink() const; + TFsPath ReadLink() const; /// always absolute static TFsPath Cwd(); |