mirror of
https://github.com/bettercap/bettercap
synced 2025-08-14 02:36:57 -07:00
misc: refactored caplets code in a dedicated package
This commit is contained in:
parent
d16b0c7cf5
commit
9721c1d6e0
7 changed files with 209 additions and 157 deletions
32
caplets/env.go
Normal file
32
caplets/env.go
Normal file
|
@ -0,0 +1,32 @@
|
|||
package caplets
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/bettercap/bettercap/core"
|
||||
)
|
||||
|
||||
const (
|
||||
Suffix = ".cap"
|
||||
InstallPath = "/usr/local/share/bettercap/caplets/"
|
||||
)
|
||||
|
||||
var (
|
||||
LoadPaths = []string{
|
||||
"./caplets/",
|
||||
InstallPath,
|
||||
}
|
||||
)
|
||||
|
||||
func init() {
|
||||
for _, path := range core.SepSplit(core.Trim(os.Getenv("CAPSPATH")), ":") {
|
||||
if path = core.Trim(path); len(path) > 0 {
|
||||
LoadPaths = append(LoadPaths, path)
|
||||
}
|
||||
}
|
||||
|
||||
for i, path := range LoadPaths {
|
||||
LoadPaths[i], _ = filepath.Abs(path)
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue