MCPcopy Create free account
hub / github.com/catboost/catboost / RealPath

Function RealPath

util/folder/dirut.cpp:439–449  ·  view source on GitHub ↗

Implementation of realpath in FreeBSD (version 9.0 and less) and GetFullPathName in Windows did not require last component of the file name to exist (other implementations will fail if it does not). Use RealLocation if that behaviour is required.

Source from the content-addressed store, hash-verified

437// did not require last component of the file name to exist (other implementations will fail
438// if it does not). Use RealLocation if that behaviour is required.
439TString RealPath(const TString& path) {
440 TTempBuf result;
441 Y_ASSERT(result.Size() > MAX_PATH); // TMP_BUF_LEN > MAX_PATH
442#ifdef _win_
443 if (GetFullPathName(path.data(), result.Size(), result.Data(), nullptr) == 0)
444#else
445 if (realpath(path.data(), result.Data()) == nullptr)
446#endif
447 ythrow TFileError() << "RealPath failed \"" << path << "\"";
448 return result.Data();
449}
450
451TString RealLocation(const TString& path) {
452 if (NFs::Exists(path)) {

Callers 6

LoadFilesAndSubdirsMethod · 0.85
FreeBSDGuessExecPathFunction · 0.85
RealLocationFunction · 0.85
Y_UNIT_TESTFunction · 0.85
GetNameMethod · 0.85
RealPathMethod · 0.85

Calls 4

realpathFunction · 0.70
SizeMethod · 0.45
dataMethod · 0.45
DataMethod · 0.45

Tested by

no test coverage detected