BUG: ConfigureFile must read/write in binary mode to avoid windows newline trouble. The problem occurred when configuring a file in cygwin from a path starting with a windows drive letter instead of a posix path.

This commit is contained in:
Brad King 2006-08-26 14:37:31 -04:00
parent 9b89d84210
commit 7a31bc8521
1 changed files with 10 additions and 2 deletions

View File

@ -2617,7 +2617,11 @@ int cmMakefile::ConfigureFile(const char* infile, const char* outfile,
{
std::string tempOutputFile = soutfile;
tempOutputFile += ".tmp";
std::ofstream fout(tempOutputFile.c_str());
std::ofstream fout(tempOutputFile.c_str()
#if defined(_WIN32) || defined(__CYGWIN__)
, std::ios::out | std::ios::binary
#endif
);
if(!fout)
{
cmSystemTools::Error(
@ -2626,7 +2630,11 @@ int cmMakefile::ConfigureFile(const char* infile, const char* outfile,
cmSystemTools::ReportLastSystemError("");
return 0;
}
std::ifstream fin(sinfile.c_str());
std::ifstream fin(sinfile.c_str()
#if defined(_WIN32) || defined(__CYGWIN__)
, std::ios::in | std::ios::binary
#endif
);
if(!fin)
{
cmSystemTools::Error("Could not open file for read in copy operation ",