Cleanup path logics with pathExists and binaryExists

This commit is contained in:
Filippo Valsorda
2019-06-01 14:55:58 +01:00
parent b1564cfb0d
commit 245b2732c8
5 changed files with 33 additions and 44 deletions

View File

@@ -39,19 +39,16 @@ func init() {
hasJava = true
javaHome = v
_, err := os.Stat(filepath.Join(v, keytoolPath))
if err == nil {
if pathExists(filepath.Join(v, keytoolPath)) {
hasKeytool = true
keytoolPath = filepath.Join(v, keytoolPath)
}
_, err = os.Stat(filepath.Join(v, "lib", "security", "cacerts"))
if err == nil {
if pathExists(filepath.Join(v, "lib", "security", "cacerts")) {
cacertsPath = filepath.Join(v, "lib", "security", "cacerts")
}
_, err = os.Stat(filepath.Join(v, "jre", "lib", "security", "cacerts"))
if err == nil {
if pathExists(filepath.Join(v, "jre", "lib", "security", "cacerts")) {
cacertsPath = filepath.Join(v, "jre", "lib", "security", "cacerts")
}
}