diff --git a/src/factorio_server.go b/src/factorio_server.go index 94ad6b6..e228b9b 100644 --- a/src/factorio_server.go +++ b/src/factorio_server.go @@ -264,7 +264,7 @@ func (f *FactorioServer) parseRunningCommand(std io.ReadCloser) (err error) { } func (f *FactorioServer) writeLog(logline string) error { - logfileName := config.FactorioDir + "factorio-server-console.log" + logfileName := filepath.Join(config.FactorioDir, "factorio-server-console.log") file, err := os.OpenFile(logfileName, os.O_APPEND|os.O_WRONLY|os.O_CREATE, 0644) if err != nil { log.Printf("Cannot open logfile for appending Factorio Server output: %s", err) diff --git a/src/wsroutes.go b/src/wsroutes.go index 8fea9cd..6c06cdb 100644 --- a/src/wsroutes.go +++ b/src/wsroutes.go @@ -2,13 +2,14 @@ package main import ( "log" + "path/filepath" "github.com/hpcloud/tail" ) func logSubscribe(client *Client, data interface{}) { go func() { - logfile := config.FactorioDir + "factorio-server-console.log" + logfile := filepath.Join(config.FactorioDir, "factorio-server-console.log") t, err := tail.TailFile(logfile, tail.Config{Follow: true}) if err != nil { log.Printf("Error subscribing to tail log %s", err)