支持通过绝对路径运行gocron #45

develop
ouqiang 2018-04-17 21:10:21 +08:00
parent 83f8b67b20
commit 64128f37e0
3 changed files with 5 additions and 5 deletions

View File

@ -1,4 +1,4 @@
// main gocron
// Command gocron
package main

View File

@ -1,5 +1,4 @@
// main gocron-node
// Command gocron-node
package main
import (

View File

@ -2,6 +2,7 @@ package app
import (
"os"
"path/filepath"
"fmt"
"io/ioutil"
@ -27,11 +28,11 @@ var (
func InitEnv(versionString string) {
logger.InitLogger()
wd, err := os.Getwd()
var err error
AppDir, err = filepath.Abs(filepath.Dir(os.Args[0]))
if err != nil {
logger.Fatal(err)
}
AppDir = wd
ConfDir = AppDir + "/conf"
LogDir = AppDir + "/log"
DataDir = AppDir + "/data"