@@ -199,7 +199,10 @@ bool ProjMgrWorker::ParseContextLayers(ContextItem& context) {
199199 continue ;
200200 }
201201 if (CheckContextFilters (clayer.typeFilter , context)) {
202- error_code ec;
202+ const auto variable = ProjMgrUtils::GetVariableName (clayer.layer );
203+ if (!variable.empty ()) {
204+ context.layerVariables [clayer.type ] = variable;
205+ }
203206 string clayerFile = RteUtils::ExpandAccessSequences (clayer.layer , context.variables );
204207 if (clayerFile.empty ()) {
205208 continue ;
@@ -208,16 +211,9 @@ bool ProjMgrWorker::ParseContextLayers(ContextItem& context) {
208211 RteFsUtils::NormalizePath (clayerFile, context.cproject ->directory );
209212 }
210213 if (!RteFsUtils::Exists (clayerFile)) {
211- smatch sm;
212- try {
213- regex_match (clayer.layer , sm, regex (" .*\\ $(.*)\\ $.*" ));
214- }
215- catch (exception&) {};
216- if (sm.size () >= 2 ) {
217- if (context.variables .find (sm[1 ]) == context.variables .end ()) {
218- m_undefLayerVars.insert (string (sm[1 ]));
219- continue ;
220- }
214+ if (!variable.empty () && context.variables .find (variable) == context.variables .end ()) {
215+ m_undefLayerVars.insert (string (variable));
216+ continue ;
221217 }
222218 }
223219 if (m_parser->ParseClayer (clayerFile, m_checkSchema)) {
@@ -860,7 +856,10 @@ bool ProjMgrWorker::ProcessLayerCombinations(ContextItem& context, LayersDiscove
860856
861857 // init list of compatible layers with all required layer types
862858 for (const auto & type : discover.requiredLayerTypes ) {
863- context.compatibleLayers .insert ({ type, StrVec () });
859+ context.compatibleLayers .emplace (type, StrVec ());
860+ }
861+ for (const auto & [type, _] : context.layerVariables ) {
862+ context.compatibleLayers .emplace (type, StrVec ());
864863 }
865864 // update list of compatible layers
866865 context.validConnections .push_back (combination);
0 commit comments