createFilesWithParentDirs(): Use binary mode to preserve original newlines on Windows

This commit is contained in:
Kamil Śliwak 2021-08-30 20:17:19 +02:00
parent d4d778de77
commit a61a950861

View File

@ -31,7 +31,8 @@ void solidity::test::createFilesWithParentDirs(set<boost::filesystem::path> cons
if (!path.parent_path().empty())
boost::filesystem::create_directories(path.parent_path());
ofstream newFile(path.string());
// Use binary mode to avoid line ending conversion on Windows.
ofstream newFile(path.string(), std::ofstream::binary);
newFile << _content;
if (newFile.fail() || !boost::filesystem::exists(path))