| 110 | } |
| 111 | |
| 112 | bool cmListFileParser::ParseFile(char const* filename) |
| 113 | { |
| 114 | this->FileName = filename; |
| 115 | |
| 116 | #ifdef _WIN32 |
| 117 | std::string expandedFileName = cmsys::Encoding::ToNarrow( |
| 118 | cmSystemTools::ConvertToWindowsExtendedPath(filename)); |
| 119 | filename = expandedFileName.c_str(); |
| 120 | #endif |
| 121 | |
| 122 | // Open the file. |
| 123 | cmListFileLexer_BOM bom; |
| 124 | if (!cmListFileLexer_SetFileName(this->Lexer.get(), filename, &bom)) { |
| 125 | this->IssueFileOpenError("cmListFileCache: error can not open file."); |
| 126 | return false; |
| 127 | } |
| 128 | |
| 129 | // Verify the Byte-Order-Mark, if any. |
| 130 | if (bom != cmListFileLexer_BOM_None && bom != cmListFileLexer_BOM_UTF8) { |
| 131 | cmListFileLexer_SetFileName(this->Lexer.get(), nullptr, nullptr); |
| 132 | this->IssueFileOpenError( |
| 133 | "File starts with a Byte-Order-Mark that is not UTF-8."); |
| 134 | return false; |
| 135 | } |
| 136 | |
| 137 | return this->Parse(); |
| 138 | } |
| 139 | |
| 140 | bool cmListFileParser::ParseString(cm::string_view str, |
| 141 | char const* virtual_filename) |
nothing calls this directly
no test coverage detected