@@ -45,6 +45,8 @@ VISIT_RESULT CheckFilesVisitor::Visit(RteItem* item)
4545 m_checkFiles.CheckDeprecated (item);
4646 m_checkFiles.CheckDescription (item);
4747 m_checkFiles.GatherIncPathVsAttrConfig (item);
48+ m_checkFiles.CheckCSolutionEntries (item);
49+
4850
4951 return VISIT_RESULT::CONTINUE_VISIT;
5052}
@@ -421,6 +423,11 @@ bool CheckFiles::CheckFileExists(const string& fileName, int lineNo, bool associ
421423
422424 string checkPath = GetFullFilename (fileName);
423425
426+ if (XmlValueAdjuster::IsAbsolute (fileName)) {
427+ LogMsg (" M326" , PATH (fileName), lineNo); // error : absolute paths are not permitted
428+ return false ;
429+ }
430+
424431 bool ok = true ;
425432 if (!RteFsUtils::Exists (checkPath)) {
426433 if (associated) {
@@ -533,7 +540,7 @@ bool CheckFiles::CheckCaseSense(const string& fileName, int lineNo)
533540 }
534541 else {
535542 string errMsg = string (" file/folder \" " ) + seg + " \" not found" ;
536- LogMsg (" M103" , VAL (" REF" , errMsg));
543+ LogMsg (" M103" , VAL (" REF" , errMsg), lineNo );
537544 return false ;
538545 }
539546 }
@@ -899,7 +906,6 @@ bool CheckFiles::CheckFileExtension(RteItem* item)
899906 return ok;
900907}
901908
902-
903909bool CheckFiles::GatherIncPathVsAttrConfig (RteItem* item)
904910{
905911 const auto file = dynamic_cast <RteFile*>(item);
@@ -952,3 +958,100 @@ bool CheckFiles::CheckAttrConfigFiles()
952958 return bOk;
953959}
954960
961+ bool CheckFiles::CheckCSolutionEntries (RteItem* item)
962+ {
963+ if (item->GetTag () != " csolution" ) {
964+ return true ;
965+ }
966+
967+ bool bOk = true ;
968+ const auto lineNo = item->GetLineNumber ();
969+
970+ const auto & children = item->GetChildren ();
971+ if (children.empty ()) {
972+ LogMsg (" M100" , lineNo); // No entries for %TAG% found
973+ return false ;
974+ }
975+
976+ for (const auto & child : children) {
977+ const auto & tag = child->GetTag ();
978+ if (tag == " clayer" ) {
979+ CheckCsolutionLayer (child);
980+ }
981+ else if (tag == " template" ) {
982+ CheckCsolutionTemplate (child);
983+ }
984+ }
985+
986+ return bOk;
987+ }
988+
989+ bool CheckFiles::CheckForTag (RteItem* item, const list<string>& searchAttributes)
990+ {
991+ const auto lineNo = item->GetLineNumber ();
992+ const auto & tag = item->GetTag ();
993+ bool bOk = true ;
994+
995+ for (const auto & searchAttr : searchAttributes) {
996+ if (item->GetAttribute (searchAttr) == " " ) {
997+ LogMsg (" M601" , TAG (searchAttr), TAG2 (tag), lineNo); // '%TAG%' missing on '%TAG2%'
998+ bOk = false ;
999+ }
1000+ }
1001+
1002+ return bOk;
1003+ }
1004+
1005+ bool CheckFiles::CheckCsolutionLayer (RteItem* item)
1006+ {
1007+ CheckForTag (item, list<string>({" type" , " path" , " file" }));
1008+
1009+ const auto lineNo = item->GetLineNumber ();
1010+ const auto & path = item->GetAttribute (" path" );
1011+ const auto & file = item->GetAttribute (" file" );
1012+
1013+ if (!path.empty () && !file.empty ()) {
1014+ const auto fileName = path + " /" + file;
1015+ CheckForSpaces (fileName, lineNo);
1016+ if (CheckFileExists (fileName, lineNo)) {
1017+ CheckCaseSense (fileName, lineNo);
1018+ CheckFileIsInPack (fileName, lineNo);
1019+ }
1020+ }
1021+
1022+
1023+ return true ;
1024+ }
1025+
1026+ bool CheckFiles::CheckCsolutionTemplate (RteItem* item)
1027+ {
1028+ CheckForTag (item, list<string>({" name" , " path" , " file" }));
1029+
1030+ const auto lineNo = item->GetLineNumber ();
1031+ const auto & tag = item->GetTag ();
1032+ const auto & children = item->GetChildren ();
1033+ const auto & path = item->GetAttribute (" path" );
1034+ const auto & file = item->GetAttribute (" file" );
1035+
1036+ if (!path.empty () && !file.empty ()) {
1037+ const auto fileName = path + " /" + file;
1038+ CheckForSpaces (fileName, lineNo);
1039+ if (CheckFileExists (fileName, lineNo)) {
1040+ CheckCaseSense (fileName, lineNo);
1041+ CheckFileIsInPack (fileName, lineNo);
1042+ }
1043+ }
1044+
1045+ bool bFound = false ;
1046+ for (const auto child : children) {
1047+ if (child->GetTag () == " description" ) {
1048+ bFound = true ;
1049+ }
1050+ }
1051+
1052+ if (!bFound) {
1053+ LogMsg (" M601" , TAG (" description" ), TAG2 (tag), lineNo); // '%TAG%' missing on '%TAG2%'
1054+ }
1055+
1056+ return bFound;
1057+ }
0 commit comments