Skip to content

Commit e9bb0bc

Browse files
committed
Chomp newline at the end of JAVA_HOME when reading from ~/.java_home
1 parent 12bc2e5 commit e9bb0bc

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Package.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ func findJavaHome() -> String {
1919
// picking up env variables during the build process
2020
let path = "\(FileManager.default.homeDirectoryForCurrentUser.path()).java_home"
2121
if let home = try? String(contentsOfFile: path) {
22+
if let lastChar = home.last, lastChar.isNewline {
23+
return String(home.dropLast())
24+
}
25+
2226
return home
2327
}
2428

0 commit comments

Comments
 (0)