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 | addb3626ed629a8c7d9c8c30e87365b478a8c266 (patch) | |
tree | c0748b5dcbade83af788c0abfa89c0383d6b779c /util/folder | |
parent | 57c20d143e8a438cd76b9fdc3ca2e8ee3ac1f32a (diff) | |
download | ydb-addb3626ed629a8c7d9c8c30e87365b478a8c266.tar.gz |
Restoring authorship annotation for <denplusplus@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'util/folder')
-rw-r--r-- | util/folder/dirut.cpp | 18 | ||||
-rw-r--r-- | util/folder/dirut.h | 56 | ||||
-rw-r--r-- | util/folder/filelist.h | 22 |
3 files changed, 48 insertions, 48 deletions
diff --git a/util/folder/dirut.cpp b/util/folder/dirut.cpp index c603c28dcc..ffc9b09f96 100644 --- a/util/folder/dirut.cpp +++ b/util/folder/dirut.cpp @@ -189,7 +189,7 @@ using disk_type = enum { dk_error = 8 }; -// root slash (if any) - part of disk +// root slash (if any) - part of disk template <typename T> static int skip_disk(T*& ptr) { int result = dk_noflags; @@ -240,7 +240,7 @@ int correctpath(char* cpath, const char* path) { *cptr = 0; // replace '/' by '\' int dk = skip_disk(cpath); - + if (dk == dk_error) return 0; @@ -366,15 +366,15 @@ bool resolvepath(TString& folder, const TString& home) { return false; } -#endif // !defined _win32_ - +#endif // !defined _win32_ + char GetDirectorySeparator() { - return LOCSLASH_C; -} - + return LOCSLASH_C; +} + const char* GetDirectorySeparatorS() { - return LOCSLASH_S; -} + return LOCSLASH_S; +} void RemoveDirWithContents(TString dirName) { SlashFolderLocal(dirName); diff --git a/util/folder/dirut.h b/util/folder/dirut.h index 91b65c028e..2537027b12 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; +}; diff --git a/util/folder/filelist.h b/util/folder/filelist.h index 384f5ed1bc..3f615fa4c2 100644 --- a/util/folder/filelist.h +++ b/util/folder/filelist.h @@ -22,12 +22,12 @@ public: TFileEntitiesList(EMask mask) : Mask(mask) { - Clear(); + Clear(); } void Clear() { Cur = nullptr; - FileNamesSize = CurName = 0; + FileNamesSize = CurName = 0; FileNames.Clear(); FileNames.Append("", 1); } @@ -36,8 +36,8 @@ public: return Cur = (CurName++ < FileNamesSize ? strchr(Cur, 0) + 1 : nullptr); } - size_t Size() { - return FileNamesSize; + size_t Size() { + return FileNamesSize; } inline void Fill(const TString& dirname, bool sort = false) { @@ -57,25 +57,25 @@ public: protected: TBuffer FileNames; - size_t FileNamesSize, CurName; + size_t FileNamesSize, CurName; const char* Cur; - EMask Mask; + EMask Mask; }; Y_DECLARE_OPERATORS_FOR_FLAGS(TFileEntitiesList::EMask) class TFileList: public TFileEntitiesList { -public: +public: TFileList() : TFileEntitiesList(TFileEntitiesList::EM_FILES) { } -}; - +}; + class TDirsList: public TFileEntitiesList { -public: +public: TDirsList() : TFileEntitiesList(TFileEntitiesList::EM_DIRS) { } -}; +}; |