From 94b7c4b4a12a743249b6851052421f64d91f8738 Mon Sep 17 00:00:00 2001 From: shylinux Date: Fri, 10 Mar 2023 10:03:28 +0800 Subject: [PATCH] opt some --- base/cli/runtime.go | 7 ++----- base/mdb/hash.go | 1 - base/web/serve.go | 6 +++--- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/base/cli/runtime.go b/base/cli/runtime.go index 1d997e8a..91582089 100644 --- a/base/cli/runtime.go +++ b/base/cli/runtime.go @@ -26,7 +26,7 @@ func _runtime_init(m *ice.Message) { m.Conf(RUNTIME, kit.Keys(HOST, OSID), release(m)) m.Conf(RUNTIME, kit.Keys(HOST, PID), os.Getpid()) m.Conf(RUNTIME, kit.Keys(HOST, PWD), kit.Path("")) - m.Conf(RUNTIME, kit.Keys(HOST, HOME), kit.Env(HOME)) + m.Conf(RUNTIME, kit.Keys(HOST, HOME), kit.HomePath("")) m.Conf(RUNTIME, kit.Keys(HOST, MAXPROCS), runtime.GOMAXPROCS(0)) for _, k := range ENV_LIST { switch m.Conf(RUNTIME, kit.Keys(CONF, k), kit.Env(k)); k { @@ -42,10 +42,7 @@ func _runtime_init(m *ice.Message) { if name, e := os.Hostname(); e == nil && name != "" { m.Conf(RUNTIME, kit.Keys(BOOT, HOSTNAME), name) } - m.Conf(RUNTIME, kit.Keys(BOOT, PATHNAME), path.Base(kit.Env("PWD"))) - if name, e := os.Getwd(); e == nil && name != "" { - m.Conf(RUNTIME, kit.Keys(BOOT, PATHNAME), path.Base(name)) - } + m.Conf(RUNTIME, kit.Keys(BOOT, PATHNAME), path.Base(kit.Path(""))) m.Conf(RUNTIME, kit.Keys(BOOT, USERNAME), kit.Select(kit.UserName(), kit.Env(CTX_USER))) ice.Info.Hostname = m.Conf(RUNTIME, kit.Keys(BOOT, HOSTNAME)) ice.Info.Pathname = m.Conf(RUNTIME, kit.Keys(BOOT, PATHNAME)) diff --git a/base/mdb/hash.go b/base/mdb/hash.go index 8456e61c..e8204f82 100644 --- a/base/mdb/hash.go +++ b/base/mdb/hash.go @@ -266,7 +266,6 @@ func HashSelectField(m *ice.Message, key string, field string) (value string) { func HashSelectTarget(m *ice.Message, key string, create Any) (target Any) { HashSelectUpdate(m, key, func(value ice.Map) { target = value[TARGET] - m.Debug("what %v %v", target, create) if _target, ok := target.([]string); ok && len(_target) == 0 { target = nil } diff --git a/base/web/serve.go b/base/web/serve.go index 02021e46..39b5cf9d 100644 --- a/base/web/serve.go +++ b/base/web/serve.go @@ -204,11 +204,11 @@ func init() { if opened { return } - switch host := kit.Format("http://localhost:%s/?debug=true", m.Option(tcp.PORT)); runtime.GOOS { + switch host := kit.Format("http://localhost:%s/", m.Option(tcp.PORT)); runtime.GOOS { + case cli.DARWIN: + m.Cmd(cli.SYSTEM, "open", host+"?debug=true") case cli.WINDOWS: m.Cmd(cli.SYSTEM, "explorer", host) - case cli.DARWIN: - m.Cmd(cli.SYSTEM, "open", host) } }() }},