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

Function JoinPathImpl

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

Source from the content-addressed store, hash-verified

36namespace internal {
37
38string JoinPathImpl(std::initializer_list<StringPiece> paths) {
39 string result;
40
41 for (StringPiece path : paths) {
42 if (path.empty()) continue;
43
44 if (result.empty()) {
45 result = string(path);
46 continue;
47 }
48
49 if (result[result.size() - 1] == '/') {
50 if (IsAbsolutePath(path)) {
51 strings::StrAppend(&result, path.substr(1));
52 } else {
53 strings::StrAppend(&result, path);
54 }
55 } else {
56 if (IsAbsolutePath(path)) {
57 strings::StrAppend(&result, path);
58 } else {
59 strings::StrAppend(&result, "/", path);
60 }
61 }
62 }
63
64 return result;
65}
66
67// Return the parts of the URI, split on the final "/" in the path. If there is
68// no "/" in the path, the first part of the output is the scheme and host, and

Callers 1

JoinPathFunction · 0.70

Calls 4

IsAbsolutePathFunction · 0.70
StrAppendFunction · 0.50
emptyMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected