mirror of https://github.com/sbt/sbt.git
Merge pull request #7085 from dos65/bspconfig_windows_path_fix
This commit is contained in:
commit
973cd63e0b
|
|
@ -13,3 +13,4 @@ npm-debug.log
|
|||
.bsp/
|
||||
metals.sbt
|
||||
launcher-package/citest/freshly-baked
|
||||
.vscode
|
||||
|
|
|
|||
|
|
@ -63,8 +63,10 @@ object BuildServerConnection {
|
|||
// For those who use an old sbt script, the -Dsbt.script is not set
|
||||
// As a fallback we try to find the sbt script in $PATH
|
||||
val fileName = if (Properties.isWin) "sbt.bat" else "sbt"
|
||||
val envPath = sys.env.getOrElse("PATH", "")
|
||||
val allPaths = envPath.split(File.pathSeparator).map(Paths.get(_))
|
||||
val envPath = sys.env.collectFirst {
|
||||
case (k, v) if k.toUpperCase() == "PATH" => v
|
||||
}
|
||||
val allPaths = envPath.map(_.split(File.pathSeparator).map(Paths.get(_))).getOrElse(Array.empty)
|
||||
allPaths
|
||||
.map(_.resolve(fileName))
|
||||
.find(file => Files.exists(file) && Files.isExecutable(file))
|
||||
|
|
|
|||
Loading…
Reference in New Issue