Skip to content

Commit

Permalink
bugfix: revert back to using embedded sbt launcher for Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
kasiaMarek committed Feb 12, 2024
1 parent 193d123 commit 6914fee
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions metals/src/main/scala/scala/meta/internal/builds/SbtBuildTool.scala
Original file line number Diff line number Diff line change
Expand Up @@ -87,18 +87,21 @@ case class SbtBuildTool(
}

private def findSbtInPath(): Option[String] = {
val envPaths =
Option(System.getenv("PATH")) match {
case Some(paths) if scala.util.Properties.isWin =>
paths.split(";").toList
case Some(paths) => paths.split(":").toList
case None => Nil
}
// on Windows sbt is not an executable
// look: https://github.com/scalameta/metals/issues/6104
if (scala.util.Properties.isWin) None
else {
val envPaths =
Option(System.getenv("PATH")) match {
case Some(paths) => paths.split(":").toList
case None => Nil
}

val allPaths = projectRoot :: envPaths.map(AbsolutePath(_))
allPaths.collectFirst { path =>
path.resolve("sbt") match {
case sbtPath if sbtPath.exists => sbtPath.toString()
val allPaths = projectRoot :: envPaths.map(AbsolutePath(_))
allPaths.collectFirst { path =>
path.resolve("sbt") match {
case sbtPath if sbtPath.exists => sbtPath.toString()
}
}
}
}
Expand Down

0 comments on commit 6914fee

Please sign in to comment.