aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/cc/ops
diff options
context:
space:
mode:
authorGravatar Martin Wicke <wicke@google.com>2016-02-07 12:34:25 -0800
committerGravatar Martin Wicke <wicke@google.com>2016-02-07 12:51:05 -0800
commit59f1eba5fb94506a205fa2e81145667754739da5 (patch)
tree4cc046caa89fdc9e8f69da7c606eaad8d8551eba /tensorflow/cc/ops
parentd53f06b6a3c77160ad955b718a04260674752298 (diff)
Merge changes from GitHub, clean up linter errors, fix dependencies test.
Change: 114064632
Diffstat (limited to 'tensorflow/cc/ops')
-rw-r--r--tensorflow/cc/ops/cc_op_gen.cc19
1 files changed, 15 insertions, 4 deletions
diff --git a/tensorflow/cc/ops/cc_op_gen.cc b/tensorflow/cc/ops/cc_op_gen.cc
index 7f46ece48e..3f0d034ff2 100644
--- a/tensorflow/cc/ops/cc_op_gen.cc
+++ b/tensorflow/cc/ops/cc_op_gen.cc
@@ -255,13 +255,24 @@ Returns a pointer to the created Node)comment");
}
// Converts:
-// bazel-out/.../genfiles/XX
+// bazel-out/.../genfiles/(external/YYY/)?XX
// to: XX.
string GetPath(const std::string& dot_h_fname) {
auto pos = dot_h_fname.find("/genfiles/");
- if (pos == string::npos) return dot_h_fname;
- // - 1 account for the terminating null character (\0) in "/genfiles/".
- return dot_h_fname.substr(pos + sizeof("/genfiles/") - 1);
+ string result = dot_h_fname;
+ if (pos != string::npos) {
+ // - 1 account for the terminating null character (\0) in "/genfiles/".
+ result = dot_h_fname.substr(pos + sizeof("/genfiles/") - 1);
+ }
+ if (result.size() > sizeof("external/") &&
+ result.compare(0, sizeof("external/") - 1, "external/") == 0) {
+ result = result.substr(sizeof("external/") - 1);
+ pos = result.find("/");
+ if (pos != string::npos) {
+ result = result.substr(pos + 1);
+ }
+ }
+ return result;
}
// Converts: