Merge pull request #892 from antipopp/master

UI hardcoded setup path changed to handle Windows installation
This commit is contained in:
Simone Margaritelli 2021-06-22 09:29:58 +02:00 committed by GitHub
commit c1770b3aa6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -9,6 +9,7 @@ import (
"os"
"path/filepath"
"regexp"
"runtime"
"github.com/bettercap/bettercap/session"
@ -29,6 +30,13 @@ type UIModule struct {
uiPath string
}
func getDefaultInstallBase() string {
if runtime.GOOS == "windows" {
return filepath.Join(os.Getenv("ALLUSERSPROFILE"), "bettercap")
}
return "/usr/local/share/bettercap/"
}
func NewUIModule(s *session.Session) *UIModule {
mod := &UIModule{
SessionModule: session.NewSessionModule("ui", s),
@ -36,7 +44,7 @@ func NewUIModule(s *session.Session) *UIModule {
}
mod.AddParam(session.NewStringParameter("ui.basepath",
"/usr/local/share/bettercap/",
getDefaultInstallBase(),
"",
"UI base installation path."))