Skip to content

Commit

Permalink
Update workdir & cross-platform paths slash
Browse files Browse the repository at this point in the history
  • Loading branch information
gencebay committed Dec 2, 2020
1 parent 22f0764 commit 201502a
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"os"
"path"
"path/filepath"
"runtime"
"strings"

. "github.com/gencebay/httplive/lib"
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 201502a

Please sign in to comment.