From 201502ab031962c9156f94c417de65438f944bdb Mon Sep 17 00:00:00 2001 From: gencebay Date: Wed, 2 Dec 2020 14:47:50 +0300 Subject: [PATCH] Update workdir & cross-platform paths slash --- main.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/main.go b/main.go index 72c387e..d66ab09 100644 --- a/main.go +++ b/main.go @@ -7,7 +7,6 @@ import ( "os" "path" "path/filepath" - "runtime" "strings" . "github.com/gencebay/httplive/lib" @@ -73,14 +72,18 @@ func host(ports string, dbPath string) { portsArr := strings.Split(ports, ",") port := portsArr[0] length := len(portsArr) + hasMultiplePort := false if length > 1 { hasMultiplePort = true } - _, filename, _, _ := runtime.Caller(0) - var workdir string = path.Dir(filename) - Environments.WorkingDirectory = workdir + workdir, err := os.Getwd() + if err != nil { + log.Fatal(err) + } + + Environments.WorkingDirectory = filepath.ToSlash(workdir) Environments.DefaultPort = port Environments.HasMultiplePort = hasMultiplePort