Skip to content

Commit 9e55070

Browse files
authored
Merge pull request #9 from moja-global/feature/installer-sync-2026-03-21
Fix installer path rewrite for repeated component names
2 parents f4ac155 + 1feb768 commit 9e55070

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

installer/fix_paths.ps1

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,11 @@ function Resolve-OldBasePath {
3333
)
3434

3535
foreach ($name in $componentNames) {
36-
$pattern = "(?<base>[A-Za-z]:\\[^`r`n]+?)\\$name(\\|/)"
37-
$match = [regex]::Match($Text, $pattern)
36+
$escapedName = [regex]::Escape($name)
37+
# Use a greedy base match so repeated folder names (e.g. gcbm_view\gcbm_view\gcbm_view)
38+
# resolve to the deepest workspace base path before the component folder.
39+
$pattern = "(?<base>[A-Za-z]:\\[^`r`n]+)\\$escapedName(?=\\|/)"
40+
$match = [regex]::Match($Text, $pattern, [System.Text.RegularExpressions.RegexOptions]::IgnoreCase)
3841
if ($match.Success) {
3942
return $match.Groups["base"].Value.TrimEnd('\')
4043
}

0 commit comments

Comments
 (0)