2022-03-16 21:24:54 +00:00
|
|
|
// +build windows
|
|
|
|
|
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2022-03-16 22:44:54 +00:00
|
|
|
"fmt"
|
2022-03-16 21:24:54 +00:00
|
|
|
"path/filepath"
|
|
|
|
"os"
|
|
|
|
)
|
|
|
|
|
2022-03-16 22:44:54 +00:00
|
|
|
func findExecutable(path string) error {
|
2022-03-16 21:24:54 +00:00
|
|
|
nameExt := filepath.Ext(path)
|
|
|
|
|
|
|
|
if nameExt == "" {
|
|
|
|
for _, ext := range filepath.SplitList(os.Getenv("PATHEXT")) {
|
|
|
|
_, err := os.Stat(path + ext)
|
2022-03-16 22:44:54 +00:00
|
|
|
if err == nil {
|
|
|
|
return nil
|
2022-03-16 21:24:54 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
_, err := os.Stat(path)
|
2022-03-16 22:44:54 +00:00
|
|
|
return err
|
2022-03-16 21:24:54 +00:00
|
|
|
}
|
|
|
|
|
2022-03-16 22:44:54 +00:00
|
|
|
return errNotExec
|
2022-03-16 21:24:54 +00:00
|
|
|
}
|