Avatars background job can be started from every directory

This commit is contained in:
Eduard Urbach 2017-06-25 18:34:21 +02:00
parent 092ba2ef0a
commit fe08764b26

View File

@ -3,6 +3,7 @@ package main
import ( import (
"fmt" "fmt"
"os" "os"
"path"
"reflect" "reflect"
"runtime" "runtime"
"time" "time"
@ -29,7 +30,14 @@ func main() {
color.Yellow("Generating user avatars") color.Yellow("Generating user avatars")
// Switch to main directory // Switch to main directory
os.Chdir("../../") exe, err := os.Executable()
if err != nil {
panic(err)
}
root := path.Dir(exe)
os.Chdir(path.Join(root, "../../"))
// Log // Log
avatarLog.AddOutput(log.File("logs/avatar.log")) avatarLog.AddOutput(log.File("logs/avatar.log"))