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

Function GetPath

tensorflow/cc/framework/cc_op_gen.cc:49–70  ·  view source on GitHub ↗

Converts: bazel-out/.../(bin|genfiles)/(external/YYY/)?XX to: XX.

Source from the content-addressed store, hash-verified

47// bazel-out/.../(bin|genfiles)/(external/YYY/)?XX
48// to: XX.
49string GetPath(const string& dot_h_fname) {
50 auto pos = dot_h_fname.find("/bin/");
51 string result = dot_h_fname;
52 if (pos != string::npos) {
53 // - 1 account for the terminating null character (\0) in "/genfiles/".
54 result = dot_h_fname.substr(pos + sizeof("/bin/") - 1);
55 } else {
56 pos = dot_h_fname.find("/genfiles/");
57 if (pos != string::npos) {
58 result = dot_h_fname.substr(pos + sizeof("/genfiles/") - 1);
59 }
60 }
61 if (result.size() > sizeof("external/") &&
62 result.compare(0, sizeof("external/") - 1, "external/") == 0) {
63 result = result.substr(sizeof("external/") - 1);
64 pos = result.find("/");
65 if (pos != string::npos) {
66 result = result.substr(pos + 1);
67 }
68 }
69 return result;
70}
71
72// Converts: some/path/to/file.xx
73// to: file

Callers 1

StartFilesFunction · 0.85

Calls 3

findMethod · 0.45
sizeMethod · 0.45
compareMethod · 0.45

Tested by

no test coverage detected