From 1e4f7195a8e35ccf9edb72e1d90e06c203b99faa Mon Sep 17 00:00:00 2001 From: Brian Atkinson Date: Wed, 19 Feb 2020 17:27:34 -0800 Subject: [PATCH] Use JoinPath over a fixed string for building paths. The fixed path doesn't work well on Windows when the correct path separator is used. PiperOrigin-RevId: 296095586 Change-Id: I9fe0459ef58a310bf471cf2548b3f7e23b764502 --- tensorflow/core/platform/resource_loader_test.cc | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tensorflow/core/platform/resource_loader_test.cc b/tensorflow/core/platform/resource_loader_test.cc index 590eb889c13..75bdca19452 100644 --- a/tensorflow/core/platform/resource_loader_test.cc +++ b/tensorflow/core/platform/resource_loader_test.cc @@ -17,17 +17,22 @@ limitations under the License. #include "tensorflow/core/platform/env.h" #include "tensorflow/core/platform/logging.h" +#include "tensorflow/core/platform/path.h" #include "tensorflow/core/platform/status.h" #include "tensorflow/core/platform/test.h" namespace tensorflow { +namespace { -const char kDataDependencyPath[] = "tensorflow/core/platform/resource_loader.h"; +string DataDependencyPath() { + return io::JoinPath("tensorflow", "core", "platform", "resource_loader.h"); +} TEST(ResourceLoaderTest, FindsAndOpensFile) { - string filepath = GetDataDependencyFilepath(kDataDependencyPath); + string filepath = GetDataDependencyFilepath(DataDependencyPath()); Status s = Env::Default()->FileExists(filepath); EXPECT_TRUE(s.ok()) << "No file found at this location: " << filepath; } +} // namespace } // namespace tensorflow