代码拉取完成,页面将自动刷新
package main
import (
"os"
"path/filepath"
"strings"
"github.com/xiaonanln/goworld/engine/config"
)
// Env represents environment variables
type Env struct {
GoWorldRoot string
}
// GetDispatcherDir returns the path to the dispatcher
func (env *Env) GetDispatcherDir() string {
return filepath.Join(env.GoWorldRoot, "components", "dispatcher")
}
// GetGateDir returns the path to the gate
func (env *Env) GetGateDir() string {
return filepath.Join(env.GoWorldRoot, "components", "gate")
}
// GetDispatcherBinary returns the path to the dispatcher binary
func (env *Env) GetDispatcherBinary() string {
return filepath.Join(env.GetDispatcherDir(), "dispatcher"+BinaryExtension)
}
// GetGateBinary returns the path to the gate binary
func (env *Env) GetGateBinary() string {
return filepath.Join(env.GetGateDir(), "gate"+BinaryExtension)
}
var env Env
func getGoSearchPaths() []string {
var paths []string
goroot := os.Getenv("GOROOT")
if goroot != "" {
paths = append(paths, goroot)
}
gopath := os.Getenv("GOPATH")
for _, p := range strings.Split(gopath, string(os.PathListSeparator)) {
if p != "" {
paths = append(paths, p)
}
}
return paths
}
func detectGoWorldPath() {
searchPaths := getGoSearchPaths()
showMsg("go search paths: %s", strings.Join(searchPaths, string(os.PathListSeparator)))
for _, sp := range searchPaths {
goworldPath := filepath.Join(sp, "src", "github.com", "xiaonanln", "goworld")
if isdir(goworldPath) {
env.GoWorldRoot = goworldPath
break
}
}
if env.GoWorldRoot == "" {
showMsgAndQuit("goworld directory is not detected")
}
showMsg("goworld directory found: %s", env.GoWorldRoot)
configFile := filepath.Join(env.GoWorldRoot, "goworld.ini")
config.SetConfigFile(configFile)
//config.Get()
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。