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:
parent
dea81b04c3
commit
1e4f7195a8
@ -17,17 +17,22 @@ limitations under the License.
|
|||||||
|
|
||||||
#include "tensorflow/core/platform/env.h"
|
#include "tensorflow/core/platform/env.h"
|
||||||
#include "tensorflow/core/platform/logging.h"
|
#include "tensorflow/core/platform/logging.h"
|
||||||
|
#include "tensorflow/core/platform/path.h"
|
||||||
#include "tensorflow/core/platform/status.h"
|
#include "tensorflow/core/platform/status.h"
|
||||||
#include "tensorflow/core/platform/test.h"
|
#include "tensorflow/core/platform/test.h"
|
||||||
|
|
||||||
namespace tensorflow {
|
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) {
|
TEST(ResourceLoaderTest, FindsAndOpensFile) {
|
||||||
string filepath = GetDataDependencyFilepath(kDataDependencyPath);
|
string filepath = GetDataDependencyFilepath(DataDependencyPath());
|
||||||
Status s = Env::Default()->FileExists(filepath);
|
Status s = Env::Default()->FileExists(filepath);
|
||||||
EXPECT_TRUE(s.ok()) << "No file found at this location: " << filepath;
|
EXPECT_TRUE(s.ok()) << "No file found at this location: " << filepath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace
|
||||||
} // namespace tensorflow
|
} // namespace tensorflow
|
||||||
|
Loading…
Reference in New Issue
Block a user