Use io::JoinPath rather than StrCat to build paths.
This breaks when trying to run on Windows. PiperOrigin-RevId: 295046481 Change-Id: I46a0c5be12894b7223f545cc842894fb8b2a55e1
This commit is contained in:
parent
8eb1ec3ddb
commit
a0199a1fef
@ -418,6 +418,7 @@ cc_library(
|
||||
"//tensorflow/core/platform:logging",
|
||||
"//tensorflow/core/platform:macros",
|
||||
"//tensorflow/core/platform:net",
|
||||
"//tensorflow/core/platform:path",
|
||||
"//tensorflow/core/platform:strcat",
|
||||
"//tensorflow/core/platform:types",
|
||||
"@com_google_googletest//:gtest",
|
||||
|
@ -19,6 +19,7 @@ limitations under the License.
|
||||
|
||||
#include "tensorflow/core/platform/logging.h"
|
||||
#include "tensorflow/core/platform/net.h"
|
||||
#include "tensorflow/core/platform/path.h"
|
||||
#include "tensorflow/core/platform/strcat.h"
|
||||
#include "tensorflow/core/platform/types.h"
|
||||
|
||||
@ -61,15 +62,13 @@ string TensorFlowSrcRoot() {
|
||||
const char* workspace = getenv("TEST_WORKSPACE");
|
||||
if (env && env[0] != '\0') {
|
||||
if (workspace && workspace[0] != '\0') {
|
||||
return strings::StrCat(env, "/", workspace, "/tensorflow");
|
||||
} else {
|
||||
return strings::StrCat(env, "/tensorflow");
|
||||
return io::JoinPath(env, workspace, "tensorflow");
|
||||
}
|
||||
} else {
|
||||
LOG(WARNING) << "TEST_SRCDIR environment variable not set: "
|
||||
<< "using $PWD/tensorflow as TensorFlowSrcRoot() for tests.";
|
||||
return "tensorflow";
|
||||
return io::JoinPath(env, "tensorflow");
|
||||
}
|
||||
LOG(WARNING) << "TEST_SRCDIR environment variable not set: "
|
||||
<< "using $PWD/tensorflow as TensorFlowSrcRoot() for tests.";
|
||||
return "tensorflow";
|
||||
}
|
||||
|
||||
} // namespace testing
|
||||
|
Loading…
Reference in New Issue
Block a user