ImportProject: Fix loading of sln without BOM

This commit is contained in:
Daniel Marjamäki 2022-02-08 08:52:27 +01:00
parent 6ef6b02153
commit f0150069c8
1 changed files with 6 additions and 4 deletions

View File

@ -466,15 +466,17 @@ bool ImportProject::importSln(std::istream &istr, const std::string &path, const
{ {
std::string line; std::string line;
// skip magic word
if (!std::getline(istr,line)) { if (!std::getline(istr,line)) {
printError("Visual Studio solution file is empty"); printError("Visual Studio solution file is empty");
return false; return false;
} }
if (!std::getline(istr, line) || line.find("Microsoft Visual Studio Solution File") != 0) { if (line.find("Microsoft Visual Studio Solution File") != 0) {
printError("Visual Studio solution file header not found"); // Skip BOM
return false; if (!std::getline(istr, line) || line.find("Microsoft Visual Studio Solution File") != 0) {
printError("Visual Studio solution file header not found");
return false;
}
} }
std::map<std::string,std::string,cppcheck::stricmp> variables; std::map<std::string,std::string,cppcheck::stricmp> variables;