From cfd0401a46891ca2d7b61e0e347e9d2e21b13bc2 Mon Sep 17 00:00:00 2001 From: knoxfighter Date: Fri, 10 May 2019 21:31:47 +0200 Subject: [PATCH] fix #149 --- src/factorio_server.go | 2 +- src/wsroutes.go | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/factorio_server.go b/src/factorio_server.go index 646ae7a..6cfea22 100644 --- a/src/factorio_server.go +++ b/src/factorio_server.go @@ -237,7 +237,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)