mirror of
https://github.com/bettercap/bettercap
synced 2025-08-14 02:36:57 -07:00
Added caplets windows compatibility
This commit is contained in:
parent
11d2756283
commit
c46bb905b9
3 changed files with 25 additions and 5 deletions
|
@ -5,6 +5,7 @@ import (
|
|||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"sort"
|
||||
"strings"
|
||||
"sync"
|
||||
|
@ -26,6 +27,9 @@ func List() []*Caplet {
|
|||
for _, fileName := range append(files, files2...) {
|
||||
if _, err := os.Stat(fileName); err == nil {
|
||||
base := strings.Replace(fileName, searchPath+"/", "", -1)
|
||||
if runtime.GOOS == "windows" {
|
||||
base = strings.Replace(fileName, searchPath+"\\", "", -1)
|
||||
}
|
||||
base = strings.Replace(base, Suffix, "", -1)
|
||||
|
||||
if err, caplet := Load(base); err != nil {
|
||||
|
@ -58,7 +62,7 @@ func Load(name string) (error, *Caplet) {
|
|||
name += Suffix
|
||||
}
|
||||
|
||||
if name[0] != '/' {
|
||||
if !filepath.IsAbs(name) {
|
||||
for _, path := range LoadPaths {
|
||||
names = append(names, filepath.Join(path, name))
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue