improve cli command install

This commit is contained in:
John Guo
2022-03-01 16:39:47 +08:00
parent 50f6b6e0f0
commit 2362c453ec

View File

@ -181,13 +181,21 @@ func (s serviceInstall) getAvailablePaths() []serviceInstallAvailablePath {
// Search and find the writable directory path.
envPath := genv.Get("PATH", genv.Get("Path").String()).String()
if gstr.Contains(envPath, ";") {
// windows.
for _, v := range gstr.SplitAndTrim(envPath, ";") {
if v == "." {
continue
}
folderPaths = s.checkAndAppendToAvailablePath(
folderPaths, v, binaryFileName,
)
}
} else if gstr.Contains(envPath, ":") {
// *nix.
for _, v := range gstr.SplitAndTrim(envPath, ":") {
if v == "." {
continue
}
folderPaths = s.checkAndAppendToAvailablePath(
folderPaths, v, binaryFileName,
)