Commit 35e9dfc7 authored by Christopher Dykes's avatar Christopher Dykes Committed by Facebook Github Bot 8

boost::filesystem::path is a wide string on Windows

Summary: Which means `.native()` returns a `wstring`, and `.c_str()` returns a `wchar_t*`. As we're using them in places expecting a `char*`, convert to `string` first.

Reviewed By: yfeldblum

Differential Revision: D3506911

fbshipit-source-id: ca34b9888f98106914438490bbd860f9b922ad5e
parent 3df144be
...@@ -82,7 +82,7 @@ void testTemporaryDirectory(TemporaryDirectory::Scope scope) { ...@@ -82,7 +82,7 @@ void testTemporaryDirectory(TemporaryDirectory::Scope scope) {
EXPECT_TRUE(fs::is_directory(path)); EXPECT_TRUE(fs::is_directory(path));
fs::path fp = path / "bar"; fs::path fp = path / "bar";
int fd = open(fp.c_str(), O_RDWR | O_CREAT | O_TRUNC, 0666); int fd = open(fp.string().c_str(), O_RDWR | O_CREAT | O_TRUNC, 0666);
EXPECT_NE(fd, -1); EXPECT_NE(fd, -1);
close(fd); close(fd);
......
...@@ -50,7 +50,7 @@ TEST(FileGen, ByLine) { ...@@ -50,7 +50,7 @@ TEST(FileGen, ByLine) {
EXPECT_EQ(lines.size(), write(file.fd(), lines.data(), lines.size())); EXPECT_EQ(lines.size(), write(file.fd(), lines.data(), lines.size()));
auto expected = from({lines}) | resplit('\n') | collect; auto expected = from({lines}) | resplit('\n') | collect;
auto found = byLine(file.path().c_str()) | collect; auto found = byLine(file.path().string().c_str()) | collect;
EXPECT_EQ(expected, found) << "For Input: '" << lines << "'"; EXPECT_EQ(expected, found) << "For Input: '" << lines << "'";
} }
...@@ -74,7 +74,7 @@ TEST_P(FileGenBufferedTest, FileWriter) { ...@@ -74,7 +74,7 @@ TEST_P(FileGenBufferedTest, FileWriter) {
auto expected = src | resplit('\n') | collect; auto expected = src | resplit('\n') | collect;
src | eachAs<StringPiece>() | toFile(File(file.fd()), bufferSize); src | eachAs<StringPiece>() | toFile(File(file.fd()), bufferSize);
auto found = byLine(file.path().c_str()) | collect; auto found = byLine(file.path().string().c_str()) | collect;
EXPECT_TRUE(expected == found); EXPECT_TRUE(expected == found);
} }
...@@ -86,7 +86,7 @@ TEST(FileGenBufferedTest, FileWriterSimple) { ...@@ -86,7 +86,7 @@ TEST(FileGenBufferedTest, FileWriterSimple) {
auto squares = seq(1, 100) | map([](int x) { return x * x; }); auto squares = seq(1, 100) | map([](int x) { return x * x; });
squares | map(toLine) | eachAs<StringPiece>() | toFile(File(file.fd())); squares | map(toLine) | eachAs<StringPiece>() | toFile(File(file.fd()));
EXPECT_EQ(squares | sum, EXPECT_EQ(squares | sum,
byLine(File(file.path().c_str())) | eachTo<int>() | sum); byLine(File(file.path().string().c_str())) | eachTo<int>() | sum);
} }
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_CASE_P(
......
...@@ -76,7 +76,7 @@ TEST(ExceptionTest, Simple) { ...@@ -76,7 +76,7 @@ TEST(ExceptionTest, Simple) {
TemporaryDirectory tmpdir; TemporaryDirectory tmpdir;
auto exnpath = tmpdir.path() / "ExceptionTest"; auto exnpath = tmpdir.path() / "ExceptionTest";
auto fp = fopen(exnpath.c_str(), "w+b"); auto fp = fopen(exnpath.string().c_str(), "w+b");
ASSERT_TRUE(fp != nullptr); ASSERT_TRUE(fp != nullptr);
SCOPE_EXIT { fclose(fp); }; SCOPE_EXIT { fclose(fp); };
......
...@@ -60,9 +60,9 @@ TEST(File, Locks) { ...@@ -60,9 +60,9 @@ TEST(File, Locks) {
enum LockMode { EXCLUSIVE, SHARED }; enum LockMode { EXCLUSIVE, SHARED };
auto testLock = [&](LockMode mode, bool expectedSuccess) { auto testLock = [&](LockMode mode, bool expectedSuccess) {
auto ret = Subprocess({helper.native(), auto ret = Subprocess({helper.string(),
mode == SHARED ? "-s" : "-x", mode == SHARED ? "-s" : "-x",
tempFile.path().native()}).wait(); tempFile.path().string()}).wait();
EXPECT_TRUE(ret.exited()); EXPECT_TRUE(ret.exited());
if (ret.exited()) { if (ret.exited()) {
EXPECT_EQ(expectedSuccess ? 0 : 42, ret.exitStatus()); EXPECT_EQ(expectedSuccess ? 0 : 42, ret.exitStatus());
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment