Skip to content

Commit

Permalink
Fixed issue where oldPath wasn't using OS specific spelling for Path/…
Browse files Browse the repository at this point in the history
…PATH

For Windows users oldPath would always return as an empty string. This is because we're using "PATH" instead of "Path".
Being's that would always return as an empty string, the newPath would always be the javaBin string.
When storing in the map, we used the OS specific Path/PATH but with the wrong information.
  • Loading branch information
mdelomba authored and tgodzik committed May 22, 2024
1 parent a009ca0 commit df933f2
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,14 @@ object JdkSources {
)
.collectFirst {
case (javaHome, javaBin) if javaHome.exists && javaBin.exists =>
val oldPath = System.getenv().getOrDefault("PATH", "")
val variableName = if (Properties.isWin) "Path" else "PATH"
val oldPath = System.getenv().getOrDefault(variableName, "")
val newPath =
if (oldPath.isEmpty()) javaBin.toString()
else {
val sep = if (Properties.isWin) ";" else ":"
s"$javaBin$sep$oldPath"
}
val variableName = if (Properties.isWin) "Path" else "PATH"
Map(
"JAVA_HOME" -> javaHome.toString(),
variableName -> newPath
Expand Down

0 comments on commit df933f2

Please sign in to comment.