MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / SplitBasename

Function SplitBasename

tensorflow/core/lib/io/path.cc:98–107  ·  view source on GitHub ↗

Return the parts of the basename of path, split on the final ".". If there is no "." in the basename or "." is the final character in the basename, the second value will be empty.

Source from the content-addressed store, hash-verified

96// If there is no "." in the basename or "." is the final character in the
97// basename, the second value will be empty.
98std::pair<StringPiece, StringPiece> SplitBasename(StringPiece path) {
99 path = Basename(path);
100
101 auto pos = path.rfind('.');
102 if (pos == StringPiece::npos)
103 return std::make_pair(path, StringPiece(path.data() + path.size(), 0));
104 return std::make_pair(
105 StringPiece(path.data(), pos),
106 StringPiece(path.data() + pos + 1, path.size() - (pos + 1)));
107}
108
109bool FixBazelEnvPath(const char* path, string* out) {
110 if (path == nullptr) return false;

Callers 1

ExtensionFunction · 0.70

Calls 3

BasenameFunction · 0.85
dataMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected