fix when reading on Linux a .mesh file produced by Windows

This commit is contained in:
Laurent Rineau 2024-01-17 09:56:39 +01:00
parent 074a337e88
commit c539c5657c
1 changed files with 5 additions and 0 deletions

View File

@ -599,6 +599,11 @@ bool build_triangulation_from_file(std::istream& is,
std::string line; std::string line;
while(std::getline(is, line) && line != "End") while(std::getline(is, line) && line != "End")
{ {
// remove trailing whitespace, in particular a possible '\r' from Windows
// end-of-line encoding
if(std::isspace(line.back())) {
line.pop_back();
}
if (line.size() > 0 && line.at(0) == '#' && if (line.size() > 0 && line.at(0) == '#' &&
line.find("CGAL::Mesh_complex_3_in_triangulation_3") != std::string::npos) line.find("CGAL::Mesh_complex_3_in_triangulation_3") != std::string::npos)
{ {