Skip to content

Commit abcc9ad

Browse files
committed
Fix incorrect path resolution for system profile under WOW64 (x86) redirection (#395)
- Issue: #395
1 parent dff3bf7 commit abcc9ad

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

maven-wrapper-distribution/src/resources/only-mvnw.cmd

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,11 @@ if (-not (Test-Path -Path $MAVEN_M2_PATH)) {
8989
}
9090

9191
$MAVEN_WRAPPER_DISTS = $null
92-
if ((Get-Item -Path $MAVEN_M2_PATH -Force).Target[0] -eq $null) {
93-
$MAVEN_WRAPPER_DISTS = "$MAVEN_M2_PATH/wrapper/dists"
92+
$m2LinkTarget = (Get-Item -Path $MAVEN_M2_PATH -Force).Target
93+
if ($m2LinkTarget -is [array] -and $m2LinkTarget.Count -gt 0) {
94+
$MAVEN_WRAPPER_DISTS = "$($m2LinkTarget[0])/wrapper/dists"
9495
} else {
95-
$MAVEN_WRAPPER_DISTS = (Get-Item -Path $MAVEN_M2_PATH -Force).Target[0] + "/wrapper/dists"
96+
$MAVEN_WRAPPER_DISTS = "$MAVEN_M2_PATH/wrapper/dists"
9697
}
9798

9899
$MAVEN_HOME_PARENT = "$MAVEN_WRAPPER_DISTS/$distributionUrlNameMain"

0 commit comments

Comments
 (0)