Skip to content

Commit

Permalink
fix SMFix could not be found on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
macdylan committed Jun 29, 2023
1 parent 234e0e6 commit 7ee6638
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"os/exec"
"path/filepath"
"regexp"
"runtime"
)

type empty struct{}
Expand Down Expand Up @@ -43,9 +44,12 @@ func searchInDir(exp string, dirpath string) (abspath string, err error) {

if found, err := filepath.Glob(filepath.Join(dirpath, exp)); err == nil {
for _, file := range found {
if stat, err := os.Stat(file); err == nil && !stat.IsDir() && stat.Mode().Perm()&0100 != 0 {
abspath = file
return abspath, nil
if stat, err := os.Stat(file); err == nil && !stat.IsDir() {
if runtime.GOOS == "windows" { // TODO: check if executable
return file, err
} else if stat.Mode().Perm()&0100 != 0 {
return file, err
}
}
}
}
Expand Down

0 comments on commit 7ee6638

Please sign in to comment.