| 133 | } |
| 134 | |
| 135 | TString NFs::ReadLink(const TString& path) { |
| 136 | #if defined(_win_) |
| 137 | return NFsPrivate::WinReadLink(path); |
| 138 | #elif defined(_unix_) |
| 139 | TTempBuf buf; |
| 140 | while (true) { |
| 141 | ssize_t r = readlink(path.data(), buf.Data(), buf.Size()); |
| 142 | if (r < 0) { |
| 143 | ythrow yexception() << "can't read link " << path << ", errno = " << errno; |
| 144 | } |
| 145 | if (r < (ssize_t)buf.Size()) { |
| 146 | return TString(buf.Data(), r); |
| 147 | } |
| 148 | buf = TTempBuf(buf.Size() * 2); |
| 149 | } |
| 150 | #endif |
| 151 | } |
| 152 | |
| 153 | void NFs::Cat(const TString& dstPath, const TString& srcPath) { |
| 154 | TUnbufferedFileInput src(srcPath); |