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
This commit is contained in:
Brian Atkinson 2020-02-19 17:27:34 -08:00 committed by TensorFlower Gardener
parent dea81b04c3
commit 1e4f7195a8

View File

@ -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