From faff8d9b38ab8892c6cdcc2e1053f621cd711d8b Mon Sep 17 00:00:00 2001 From: chip Date: Fri, 16 Sep 2022 23:44:43 +0200 Subject: [PATCH] feat: support for linux via bash --- files.go | 3 +-- fxserver.go | 9 ++++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/files.go b/files.go index 6ea7aab..482693e 100644 --- a/files.go +++ b/files.go @@ -12,8 +12,7 @@ func getConfigValues() { viper.SetConfigType("yaml") // Win viper.AddConfigPath("$HOME/.lazyfivem/") - // Linux - viper.AddConfigPath("etc/lazyfivem/") + viper.AddConfigPath("~/.lazyfivem/") err := viper.ReadInConfig() if err != nil { diff --git a/fxserver.go b/fxserver.go index 290e987..109a8fb 100644 --- a/fxserver.go +++ b/fxserver.go @@ -4,6 +4,7 @@ import ( "bufio" "fmt" "os/exec" + "runtime" "github.com/jroimartin/gocui" ) @@ -32,7 +33,13 @@ func updateFxServer(g *gocui.Gui, line string) { func startFxServer(profile string, g *gocui.Gui) { path := Servers[profile] - CfxCmd = exec.Command(path) + os := runtime.GOOS + switch os { + case "windows": + CfxCmd = exec.Command(path) + case "linux": + CfxCmd = exec.Command("bash", "-c", path) + } Writer, _ = CfxCmd.StdinPipe() r, _ := CfxCmd.StdoutPipe()