diff options
author | rdna <rdna@yandex-team.ru> | 2022-02-10 16:48:05 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:48:05 +0300 |
commit | 7804d69d166cc162c0be19dafd698a6ad7e42b25 (patch) | |
tree | 1a5e99bcef6e3f18d115f0a34d227d14178b6ce8 /util/folder | |
parent | 10ade5dcb952a8fae61f734485641a8409e1c545 (diff) | |
download | ydb-7804d69d166cc162c0be19dafd698a6ad7e42b25.tar.gz |
Restoring authorship annotation for <rdna@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'util/folder')
-rw-r--r-- | util/folder/path.cpp | 8 | ||||
-rw-r--r-- | util/folder/path.h | 30 | ||||
-rw-r--r-- | util/folder/path_ut.cpp | 26 |
3 files changed, 32 insertions, 32 deletions
diff --git a/util/folder/path.cpp b/util/folder/path.cpp index bfe0c67d68..0e162cd7f6 100644 --- a/util/folder/path.cpp +++ b/util/folder/path.cpp @@ -363,7 +363,7 @@ void TFsPath::DeleteIfExists() const { } } -void TFsPath::MkDir(const int mode) const { +void TFsPath::MkDir(const int mode) const { CheckDefined(); if (!Exists()) { int r = Mkdir(this->c_str(), mode); @@ -378,11 +378,11 @@ void TFsPath::MkDir(const int mode) const { } } -void TFsPath::MkDirs(const int mode) const { +void TFsPath::MkDirs(const int mode) const { CheckDefined(); if (!Exists()) { - Parent().MkDirs(mode); - MkDir(mode); + Parent().MkDirs(mode); + MkDir(mode); } } diff --git a/util/folder/path.h b/util/folder/path.h index 2fb4d6b4ef..e562786c5c 100644 --- a/util/folder/path.h +++ b/util/folder/path.h @@ -10,7 +10,7 @@ #include <util/string/cast.h> #include <util/system/fstat.h> #include <util/system/platform.h> -#include <util/system/sysstat.h> +#include <util/system/sysstat.h> #include <util/system/yassert.h> #include <utility> @@ -135,22 +135,22 @@ public: TFsPath Child(const TString& name) const; - /** - * @brief create this directory - * - * @param mode specifies permissions to use as described in mkdir(2), makes sense only on Unix-like systems. + /** + * @brief create this directory + * + * @param mode specifies permissions to use as described in mkdir(2), makes sense only on Unix-like systems. * * Nothing to do if dir exists. - */ - void MkDir(const int mode = MODE0777) const; - - /** - * @brief create this directory and all parent directories as needed - * - * @param mode specifies permissions to use as described in mkdir(2), makes sense only on Unix-like systems. - */ - void MkDirs(const int mode = MODE0777) const; - + */ + void MkDir(const int mode = MODE0777) const; + + /** + * @brief create this directory and all parent directories as needed + * + * @param mode specifies permissions to use as described in mkdir(2), makes sense only on Unix-like systems. + */ + void MkDirs(const int mode = MODE0777) const; + // XXX: rewrite to return iterator void List(TVector<TFsPath>& children) const; void ListNames(TVector<TString>& children) const; diff --git a/util/folder/path_ut.cpp b/util/folder/path_ut.cpp index e6a3451016..fb07bd9607 100644 --- a/util/folder/path_ut.cpp +++ b/util/folder/path_ut.cpp @@ -248,21 +248,21 @@ Y_UNIT_TEST_SUITE(TFsPathTests) { UNIT_ASSERT_VALUES_EQUAL(expected, children); } -#ifdef _unix_ +#ifdef _unix_ Y_UNIT_TEST(MkDirMode) { - TTestDirectory td("MkDirMode"); - TFsPath subDir = td.Child("subdir"); - const int mode = MODE0775; - subDir.MkDir(mode); - TFileStat stat; - UNIT_ASSERT(subDir.Stat(stat)); - // mkdir(2) places umask(2) on mode argument. - const int mask = Umask(0); - Umask(mask); + TTestDirectory td("MkDirMode"); + TFsPath subDir = td.Child("subdir"); + const int mode = MODE0775; + subDir.MkDir(mode); + TFileStat stat; + UNIT_ASSERT(subDir.Stat(stat)); + // mkdir(2) places umask(2) on mode argument. + const int mask = Umask(0); + Umask(mask); UNIT_ASSERT_VALUES_EQUAL(stat.Mode& MODE0777, mode & ~mask); - } -#endif - + } +#endif + Y_UNIT_TEST(Cwd) { UNIT_ASSERT_VALUES_EQUAL(TFsPath::Cwd().RealPath(), TFsPath(".").RealPath()); } |