diff --git a/tools/projmgr/src/ProjMgrWorker.cpp b/tools/projmgr/src/ProjMgrWorker.cpp
index 3c8d5bade..f94624b5c 100644
--- a/tools/projmgr/src/ProjMgrWorker.cpp
+++ b/tools/projmgr/src/ProjMgrWorker.cpp
@@ -3531,7 +3531,9 @@ void ProjMgrWorker::ExpandAccessSequence(ContextItem& context, const ContextItem
replacement = refContext.outputTypes.map.on ? refContextOutDir + "/" + refContext.outputTypes.map.filename : "";
}
// store sequence and its evaluated absolute path
- context.absPathSequences[item.substr(1, item.size() - 2)] = replacement;
+ const auto start = item.find_first_of('$') + 1;
+ const auto end = item.find_last_of('$') - start;
+ context.absPathSequences[item.substr(start, end)] = replacement;
// get relative path
if (!replacement.empty() && !outdir.empty()) {
replacement = RteFsUtils::RelativePath(replacement, outdir, withHeadingDot);
diff --git a/tools/projmgr/test/data/TestLayers/ref/variables/variables.BuildType1+TargetType1.cprj b/tools/projmgr/test/data/TestLayers/ref/variables/variables.BuildType1+TargetType1.cprj
index ba0c2e7ca..211a53787 100644
--- a/tools/projmgr/test/data/TestLayers/ref/variables/variables.BuildType1+TargetType1.cprj
+++ b/tools/projmgr/test/data/TestLayers/ref/variables/variables.BuildType1+TargetType1.cprj
@@ -18,7 +18,7 @@
App-Layer;Build1-Layer;SolutionDir-Layer;Target1-Layer
- out/variables/TargetType1/BuildType1
+ out/variables/TargetType1/BuildType1/subfolder
diff --git a/tools/projmgr/test/data/TestLayers/ref/variables/variables.BuildType1+TargetType2.cprj b/tools/projmgr/test/data/TestLayers/ref/variables/variables.BuildType1+TargetType2.cprj
index 00cc2b1de..9d19e19e4 100644
--- a/tools/projmgr/test/data/TestLayers/ref/variables/variables.BuildType1+TargetType2.cprj
+++ b/tools/projmgr/test/data/TestLayers/ref/variables/variables.BuildType1+TargetType2.cprj
@@ -18,7 +18,7 @@
App-Layer;Build1-Layer;SolutionDir-Layer;Target2-Layer
- out/variables/TargetType2/BuildType1
+ out/variables/TargetType2/BuildType1/subfolder
diff --git a/tools/projmgr/test/data/TestLayers/ref/variables/variables.BuildType2+TargetType1.cprj b/tools/projmgr/test/data/TestLayers/ref/variables/variables.BuildType2+TargetType1.cprj
index 8b9ac8dd4..43e40912a 100644
--- a/tools/projmgr/test/data/TestLayers/ref/variables/variables.BuildType2+TargetType1.cprj
+++ b/tools/projmgr/test/data/TestLayers/ref/variables/variables.BuildType2+TargetType1.cprj
@@ -18,7 +18,7 @@
App-Layer;Build2-Layer;SolutionDir-Layer;Target1-Layer
- out/variables/TargetType1/BuildType2
+ out/variables/TargetType1/BuildType2/subfolder
diff --git a/tools/projmgr/test/data/TestLayers/ref/variables/variables.BuildType2+TargetType2.cprj b/tools/projmgr/test/data/TestLayers/ref/variables/variables.BuildType2+TargetType2.cprj
index 6fdbb9e12..693113a6c 100644
--- a/tools/projmgr/test/data/TestLayers/ref/variables/variables.BuildType2+TargetType2.cprj
+++ b/tools/projmgr/test/data/TestLayers/ref/variables/variables.BuildType2+TargetType2.cprj
@@ -18,7 +18,7 @@
App-Layer;Build2-Layer;SolutionDir-Layer;Target2-Layer
- out/variables/TargetType2/BuildType2
+ out/variables/TargetType2/BuildType2/subfolder
diff --git a/tools/projmgr/test/data/TestLayers/variables/solutionDir.clayer.yml b/tools/projmgr/test/data/TestLayers/variables/solutionDir.clayer.yml
index ac58bd7ed..9acf75674 100644
--- a/tools/projmgr/test/data/TestLayers/variables/solutionDir.clayer.yml
+++ b/tools/projmgr/test/data/TestLayers/variables/solutionDir.clayer.yml
@@ -3,7 +3,7 @@
layer:
add-path:
- - $OutDir()$
+ - $OutDir()$/subfolder
define:
- SolutionDir-Layer