diff options
author | denplusplus <denplusplus@yandex-team.ru> | 2022-02-10 16:47:34 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:47:34 +0300 |
commit | 57c20d143e8a438cd76b9fdc3ca2e8ee3ac1f32a (patch) | |
tree | cc63639f8e502db19a82c20e2861c6d1edbf9fea /util/folder/dirut.h | |
parent | 464ba3814a83db4f2d5327393b0b6eaf0c86bfd7 (diff) | |
download | ydb-57c20d143e8a438cd76b9fdc3ca2e8ee3ac1f32a.tar.gz |
Restoring authorship annotation for <denplusplus@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'util/folder/dirut.h')
-rw-r--r-- | util/folder/dirut.h | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/util/folder/dirut.h b/util/folder/dirut.h index 2537027b12..91b65c028e 100644 --- a/util/folder/dirut.h +++ b/util/folder/dirut.h @@ -56,9 +56,9 @@ void SlashFolderLocal(TString& folder); bool correctpath(TString& filename); bool resolvepath(TString& folder, const TString& home); -char GetDirectorySeparator(); -const char* GetDirectorySeparatorS(); - +char GetDirectorySeparator(); +const char* GetDirectorySeparatorS(); + void RemoveDirWithContents(TString dirName); const char* GetFileNameComponent(const char* f); @@ -84,36 +84,36 @@ TString ResolveDir(const char* path); bool SafeResolveDir(const char* path, TString& result); TString GetDirName(const TString& path); - + TString GetBaseName(const TString& path); TString StripFileComponent(const TString& fileName); -class TExistenceChecker { -public: - TExistenceChecker(bool strict = false) - : Strict(strict) - { - } - - void SetStrict(bool strict) { - Strict = strict; - } - - bool IsStrict() const { - return Strict; - } - - const char* Check(const char* fname) const { - if (!fname || !*fname) +class TExistenceChecker { +public: + TExistenceChecker(bool strict = false) + : Strict(strict) + { + } + + void SetStrict(bool strict) { + Strict = strict; + } + + bool IsStrict() const { + return Strict; + } + + const char* Check(const char* fname) const { + if (!fname || !*fname) return nullptr; - if (Strict) { + if (Strict) { NFs::EnsureExists(fname); } else if (!NFs::Exists(fname)) fname = nullptr; - return fname; - } - -private: - bool Strict; -}; + return fname; + } + +private: + bool Strict; +}; |