diff --git a/base/nfs/dir.go b/base/nfs/dir.go index 9b3110f9..ad585ba7 100644 --- a/base/nfs/dir.go +++ b/base/nfs/dir.go @@ -4,7 +4,6 @@ import ( "os" "path" "regexp" - "runtime" "strings" ice "shylinux.com/x/icebergs" @@ -179,9 +178,7 @@ func init() { aaa.Black(m, ice.USR_LOCAL) }}, mdb.UPLOAD: {}, mdb.SEARCH: {Hand: func(m *ice.Message, arg ...string) { - m.Debug("what ") - if arg[0] == mdb.FOREACH && arg[1] == "" && runtime.GOOS == "darwin" && m.Cmdx("host", "islocal", m.Option(ice.MSG_USERIP)) == ice.OK { - m.Debug("what ") + if arg[0] == mdb.FOREACH && arg[1] == "" && m.Cmdx("host", "islocal", m.Option(ice.MSG_USERIP)) == ice.OK { for _, p := range []string{"Desktop", "Documents", "Downloads", "Pictures"} { p := kit.HomePath(p) m.Cmd(DIR, PWD, mdb.NAME, mdb.TIME, kit.Dict(DIR_ROOT, p)).SortTimeR(mdb.TIME).TablesLimit(5, func(value ice.Maps) { diff --git a/core/chat/search.go b/core/chat/search.go index a5d72053..e087634a 100644 --- a/core/chat/search.go +++ b/core/chat/search.go @@ -1,13 +1,14 @@ package chat import ( - "strings" + "runtime" ice "shylinux.com/x/icebergs" "shylinux.com/x/icebergs/base/cli" "shylinux.com/x/icebergs/base/ctx" "shylinux.com/x/icebergs/base/mdb" "shylinux.com/x/icebergs/base/web" + kit "shylinux.com/x/toolkits" ) const SEARCH = "search" @@ -16,10 +17,19 @@ func init() { Index.MergeCommands(ice.Commands{ web.P(SEARCH): {Name: "/search", Help: "搜索框", Actions: ice.MergeActions(ice.Actions{ cli.OPENS: {Hand: func(m *ice.Message, arg ...string) { - if strings.HasSuffix(arg[0], ".app") { - m.Cmd(cli.SYSTEM, cli.OPEN, "-a", arg[0]) - } else { - m.Cmd(cli.SYSTEM, cli.OPEN, arg[0]) + switch runtime.GOOS { + case cli.DARWIN: + if kit.Ext(arg[0]) == "app" { + m.Cmd(cli.SYSTEM, cli.OPEN, "-a", arg[0]) + } else { + m.Cmd(cli.SYSTEM, cli.OPEN, arg[0]) + } + case cli.WINDOWS: + if kit.Ext(arg[0]) == "exe" { + m.Cmd(cli.SYSTEM, arg[0]) + } else { + m.Cmd(cli.SYSTEM, "explorer", arg[0]) + } } }}, }, ctx.CmdAction()), Hand: func(m *ice.Message, arg ...string) {