@@ -909,7 +909,13 @@ bool ImportProject::importVcxproj(const std::string& filename, std::map<std::str
909909 printError (" Could not simplify path to referenced shared items project" );
910910 exit (-1 );
911911 }
912- sharedItemsProjects.emplace_back (importVcxitems (pathToSharedItemsFile, fileFilters, cache));
912+ SharedItemsProject toAdd = importVcxitems (pathToSharedItemsFile, fileFilters, cache);
913+ if (!toAdd.successFull )
914+ {
915+ printError (" Could not load shared items project \" " + pathToSharedItemsFile + " \" from original path \" " + std::string (projectAttribute) + " \" ." );
916+ return false ;
917+ }
918+ sharedItemsProjects.emplace_back (toAdd);
913919 }
914920 }
915921 }
@@ -1015,12 +1021,12 @@ ImportProject::SharedItemsProject ImportProject::importVcxitems(const std::strin
10151021 const tinyxml2::XMLError error = doc.LoadFile (filename.c_str ());
10161022 if (error != tinyxml2::XML_SUCCESS) {
10171023 printError (std::string (" Visual Studio project file is not a valid XML - " ) + tinyxml2::XMLDocument::ErrorIDToName (error));
1018- exit (- 1 ) ;
1024+ return result ;
10191025 }
10201026 const tinyxml2::XMLElement* const rootnode = doc.FirstChildElement ();
10211027 if (rootnode == nullptr ) {
10221028 printError (" Visual Studio project file has no XML root node" );
1023- exit (- 1 ) ;
1029+ return result ;
10241030 }
10251031 for (const tinyxml2::XMLElement* node = rootnode->FirstChildElement (); node; node = node->NextSiblingElement ()) {
10261032 if (std::strcmp (node->Name (), " ItemGroup" ) == 0 ) {
@@ -1037,7 +1043,7 @@ ImportProject::SharedItemsProject ImportProject::importVcxitems(const std::strin
10371043 result.sourceFiles .emplace_back (file);
10381044 } else {
10391045 printError (" Could not find shared items source file" );
1040- exit (- 1 ) ;
1046+ return result ;
10411047 }
10421048 }
10431049 }
@@ -1053,6 +1059,7 @@ ImportProject::SharedItemsProject ImportProject::importVcxitems(const std::strin
10531059 }
10541060 }
10551061
1062+ result.successFull = true ;
10561063 cache.emplace_back (result);
10571064 return result;
10581065}
0 commit comments