Skip to content

Commit

Permalink
added Windows basepath to UI setup
Browse files Browse the repository at this point in the history
  • Loading branch information
antipopp committed Jun 21, 2021
1 parent 118a348 commit 58f4214
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions modules/ui/ui.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"os"
"path/filepath"
"regexp"
"runtime"

"github.com/bettercap/bettercap/session"

Expand All @@ -35,10 +36,21 @@ func NewUIModule(s *session.Session) *UIModule {
client: github.NewClient(nil),
}

mod.AddParam(session.NewStringParameter("ui.basepath",
"/usr/local/share/bettercap/",
"",
"UI base installation path."))
var basePath *session.ModuleParam

if runtime.GOOS == "windows" {
basePath = session.NewStringParameter("ui.basepath",
filepath.Join(os.Getenv("ALLUSERSPROFILE"), "bettercap"),
"",
"UI base installation path.")
} else {
basePath = session.NewStringParameter("ui.basepath",
"/usr/local/share/bettercap/",
"",
"UI base installation path.")
}

mod.AddParam(basePath)

mod.AddParam(session.NewStringParameter("ui.tmpfile",
filepath.Join(os.TempDir(), "ui.zip"),
Expand Down

0 comments on commit 58f4214

Please sign in to comment.