parent
70f19a1cf6
commit
4f82e1cf78
@ -13,8 +13,8 @@ import (
|
||||
"hash"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"strings"
|
||||
)
|
||||
|
||||
@ -29,17 +29,31 @@ var (
|
||||
)
|
||||
|
||||
func init() {
|
||||
if runtime.GOOS == "windows" {
|
||||
keytoolPath = filepath.Join("bin", "keytool.exe")
|
||||
} else {
|
||||
keytoolPath = filepath.Join("bin", "keytool")
|
||||
}
|
||||
|
||||
if v := os.Getenv("JAVA_HOME"); v != "" {
|
||||
hasJava = true
|
||||
javaHome = v
|
||||
|
||||
_, err := os.Stat(path.Join(v, "bin/keytool"))
|
||||
_, err := os.Stat(filepath.Join(v, keytoolPath))
|
||||
if err == nil {
|
||||
hasKeytool = true
|
||||
keytoolPath = path.Join(v, "bin/keytool")
|
||||
keytoolPath = filepath.Join(v, keytoolPath)
|
||||
}
|
||||
|
||||
cacertsPath = path.Join(v, "jre/lib/security/cacerts")
|
||||
_, err = os.Stat(filepath.Join(v, "lib", "security", "cacerts"))
|
||||
if err == nil {
|
||||
cacertsPath = filepath.Join(v, "lib", "security", "cacerts")
|
||||
}
|
||||
|
||||
_, err = os.Stat(filepath.Join(v, "jre", "lib", "security", "cacerts"))
|
||||
if err == nil {
|
||||
cacertsPath = filepath.Join(v, "jre", "lib", "security", "cacerts")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user