diff options
author | leo <leo@yandex-team.ru> | 2022-02-10 16:46:40 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:40 +0300 |
commit | 980edcd3304699edf9d4e4d6a656e585028e2a72 (patch) | |
tree | 139f47f3911484ae9af0eb347b1a88bd6c4bb35f /util/system/fs.cpp | |
parent | b036a557f285146e5e35d4213e29a094ab907bcf (diff) | |
download | ydb-980edcd3304699edf9d4e4d6a656e585028e2a72.tar.gz |
Restoring authorship annotation for <leo@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'util/system/fs.cpp')
-rw-r--r-- | util/system/fs.cpp | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/util/system/fs.cpp b/util/system/fs.cpp index d2611a8ccc..5ca9a77c9f 100644 --- a/util/system/fs.cpp +++ b/util/system/fs.cpp @@ -1,9 +1,9 @@ -#include "fs.h" -#include "defaults.h" +#include "fs.h" +#include "defaults.h" #if defined(_win_) #include "fs_win.h" -#else +#else #include <unistd.h> #include <errno.h> #endif @@ -11,17 +11,17 @@ #include <util/generic/yexception.h> #include <util/memory/tempbuf.h> #include <util/stream/file.h> -#include <util/charset/wide.h> +#include <util/charset/wide.h> #include <util/folder/iterator.h> #include <util/system/fstat.h> #include <util/folder/path.h> bool NFs::Remove(const TString& path) { -#if defined(_win_) +#if defined(_win_) return NFsPrivate::WinRemove(path); -#else +#else return ::remove(path.data()) == 0; -#endif +#endif } void NFs::RemoveRecursive(const TString& path) { @@ -107,19 +107,19 @@ bool NFs::HardLink(const TString& existingPath, const TString& newPath) { } bool NFs::SymLink(const TString& targetPath, const TString& linkPath) { -#if defined(_win_) +#if defined(_win_) return NFsPrivate::WinSymLink(targetPath, linkPath); -#elif defined(_unix_) +#elif defined(_unix_) return 0 == symlink(targetPath.data(), linkPath.data()); -#endif -} - +#endif +} + TString NFs::ReadLink(const TString& path) { -#if defined(_win_) +#if defined(_win_) return NFsPrivate::WinReadLink(path); -#elif defined(_unix_) - TTempBuf buf; - while (true) { +#elif defined(_unix_) + TTempBuf buf; + while (true) { ssize_t r = readlink(path.data(), buf.Data(), buf.Size()); if (r < 0) { ythrow yexception() << "can't read link " << path << ", errno = " << errno; @@ -127,11 +127,11 @@ TString NFs::ReadLink(const TString& path) { if (r < (ssize_t)buf.Size()) { return TString(buf.Data(), r); } - buf = TTempBuf(buf.Size() * 2); - } -#endif -} - + buf = TTempBuf(buf.Size() * 2); + } +#endif +} + void NFs::Cat(const TString& dstPath, const TString& srcPath) { TUnbufferedFileInput src(srcPath); TUnbufferedFileOutput dst(TFile(dstPath, ForAppend | WrOnly | Seq)); |