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

Method RelativeTo

util/folder/path.cpp:74–90  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

72}
73
74TFsPath TFsPath::RelativeTo(const TFsPath& root) const {
75 TSplit split = GetSplit();
76 const TSplit& rsplit = root.GetSplit();
77
78 if (split.Reconstruct() == rsplit.Reconstruct()) {
79 return TFsPath();
80 }
81
82 if (!this->IsSubpathOf(root)) {
83 ythrow TIoException() << "path " << *this << " is not subpath of " << root;
84 }
85
86 split.erase(split.begin(), split.begin() + rsplit.size());
87 split.IsAbsolute = false;
88
89 return TFsPath(split.Reconstruct());
90}
91
92TFsPath TFsPath::RelativePath(const TFsPath& root) const {
93 TSplit split = GetSplit();

Callers 1

Y_UNIT_TESTFunction · 0.80

Calls 7

IsSubpathOfMethod · 0.95
GetSplitMethod · 0.80
TFsPathClass · 0.70
ReconstructMethod · 0.45
eraseMethod · 0.45
beginMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected