Finish all the refine work

This commit is contained in:
zicla
2019-04-26 20:36:09 +08:00
parent f5c9616bac
commit f35852b696
4 changed files with 14 additions and 3 deletions

View File

@ -1,35 +0,0 @@
package main
import (
"fmt"
"github.com/eyebluecn/tank/code/config"
"github.com/eyebluecn/tank/code/logger"
"github.com/eyebluecn/tank/code/rest"
_ "github.com/go-sql-driver/mysql"
"log"
"net/http"
)
func main() {
//日志第一优先级保障
logger.LOGGER.Init()
defer logger.LOGGER.Destroy()
//装载配置文件,这个决定了是否需要执行安装过程
config.CONFIG.Init()
//全局运行的上下文
rest.CONTEXT.Init()
defer rest.CONTEXT.Destroy()
http.Handle("/", rest.CONTEXT.Router)
logger.LOGGER.Info("App started at http://localhost:%v", config.CONFIG.ServerPort)
dotPort := fmt.Sprintf(":%v", config.CONFIG.ServerPort)
err1 := http.ListenAndServe(dotPort, nil)
if err1 != nil {
log.Fatal("ListenAndServe: ", err1)
}
}

View File

@ -40,6 +40,8 @@ func GetDevHomePath() string {
panic("cannot get dev home path.")
}
fmt.Println(file)
dir := GetDirOfPath(file)
dir = GetDirOfPath(dir)
dir = GetDirOfPath(dir)
@ -57,6 +59,8 @@ func GetHomePath() string {
}
exPath := filepath.Dir(ex)
GetDevHomePath()
//如果exPath中包含了 /private/var/folders 我们认为是在Mac的开发环境中
macDev := strings.HasPrefix(exPath, "/private/var/folders")
if macDev {