Skip to content

Commit

Permalink
fix: NPE in findExecutableAbsolutePath if PATH isn't set
Browse files Browse the repository at this point in the history
  • Loading branch information
slisson committed Jan 28, 2025
1 parent 15cbc35 commit b08c380
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -961,9 +961,10 @@ class BuildScriptGenerator(
private fun getIdeaPluginsBuildDir(buildDir: File) = buildDir.resolve("idea-plugins")

fun findExecutableAbsolutePath(name: String): String {
return System.getenv("PATH").split(File.pathSeparatorChar)
.map { File(it).resolve(name) }
.firstOrNull { it.isFile && it.exists() }
return System.getenv("PATH")
?.split(File.pathSeparatorChar)
?.map { File(it).resolve(name) }
?.firstOrNull { it.isFile && it.exists() }
?.absolutePath
?: name
}

0 comments on commit b08c380

Please sign in to comment.