diff --git a/base/ctx/command.go b/base/ctx/command.go index 93af1834..67b7cd1a 100644 --- a/base/ctx/command.go +++ b/base/ctx/command.go @@ -122,8 +122,8 @@ func IsOrderCmd(key string) bool { return key[0] == '/' || key[0] == '_' } func FileURI(dir string) string { if dir == "" { return "" - } else if strings.Contains(dir, "/go/pkg/mod/") { - dir = strings.Split(dir, "/go/pkg/mod/")[1] + } else if strings.Contains(dir, "/pkg/mod/") { + dir = strings.Split(dir, "/pkg/mod/")[1] } else if path.IsAbs(dir) { if strings.HasPrefix(dir, kit.Path("")+nfs.PS) { dir = strings.TrimPrefix(dir, kit.Path("")+nfs.PS) diff --git a/core/chat/macos/macos.go b/core/chat/macos/macos.go index c080212d..732253a6 100644 --- a/core/chat/macos/macos.go +++ b/core/chat/macos/macos.go @@ -1,8 +1,6 @@ package macos import ( - "strings" - ice "shylinux.com/x/icebergs" "shylinux.com/x/icebergs/base/ctx" "shylinux.com/x/icebergs/base/mdb" @@ -34,7 +32,7 @@ func CmdHashAction(arg ...string) ice.Actions { } }}, mdb.SELECT: {Name: "list hash auto create", Hand: func(m *ice.Message, arg ...string) { - mdb.HashSelect(m, arg...).Sort(mdb.NAME).Display(strings.TrimPrefix(file, ice.Info.Make.Path)) + mdb.HashSelect(m, arg...).Sort(mdb.NAME).Display(ctx.FileURI(file)) }}, }, ctx.CmdAction(), mdb.HashAction(mdb.SHORT, kit.Select("", arg, 0), mdb.FIELD, kit.Select("time,hash,name,icon,text,index,args", arg, 1), kit.Slice(arg, 2))) } diff --git a/core/code/binpack.go b/core/code/binpack.go index a25961bb..ac58866f 100644 --- a/core/code/binpack.go +++ b/core/code/binpack.go @@ -58,8 +58,15 @@ func _binpack_all(m *ice.Message) { for _, p := range []string{ice.ETC_MISS_SH, ice.ETC_INIT_SHY, ice.ETC_EXIT_SHY, ice.README_MD, ice.MAKEFILE, ice.LICENSE} { _binpack_file(m, w, p) } - list, cache := map[string]string{}, kit.Select(ice.USR_REQUIRE, m.Cmdx(cli.SYSTEM, GO, "env", "GOMODCACHE")) - const _mod_ = "/pkg/mod/" + list, cache := map[string]string{}, kit.GetValid( + func() string { return m.Cmdx(cli.SYSTEM, GO, "env", "GOMODCACHE") }, + func() string { + return kit.Select(kit.HomePath("go")+nfs.PS, m.Cmdx(cli.SYSTEM, GO, "env", "GOPATH")) + "/pkg/mod/" + }, + func() string { + return ice.USR_REQUIRE + }, + ) for k := range ice.Info.File { switch ls := kit.Split(k, nfs.PS); ls[1] { case ice.SRC: @@ -67,8 +74,7 @@ func _binpack_all(m *ice.Message) { list[path.Join(kit.Slice(ls, 1, -1)...)] = "" default: p := path.Join(cache, path.Join(kit.Slice(ls, 1, -1)...)) - _ls := strings.Split(strings.Split(p, _mod_)[1], nfs.PS) - list[path.Join(nfs.USR, strings.Split(_ls[2], mdb.AT)[0], path.Join(kit.Slice(_ls, 3)...))] = p + list[path.Join(nfs.USR, strings.Split(ls[3], mdb.AT)[0], path.Join(kit.Slice(ls, 4)...))] = p } } for _, k := range kit.SortedKey(list) { diff --git a/misc/git/repos.go b/misc/git/repos.go index df42c2ac..f5b7b8d2 100644 --- a/misc/git/repos.go +++ b/misc/git/repos.go @@ -346,8 +346,18 @@ func init() { m.RenderStatusBadRequest() } else if path.Join(arg[:3]...) == ice.Info.Make.Module && nfs.Exists(m, path.Join(arg[3:]...)) { m.RenderDownload(path.Join(arg[3:]...)) + } else if p := path.Join(kit.Split(arg[2], mdb.AT)[0], path.Join(arg[3:]...)); nfs.Exists(m, p) { + m.RenderDownload(p) } else { - p := path.Join(kit.Select(ice.USR_REQUIRE, m.Cmdx(cli.SYSTEM, "go", "env", "GOMODCACHE")), path.Join(arg...)) + p := path.Join(kit.GetValid( + func() string { return m.Cmdx(cli.SYSTEM, "go", "env", "GOMODCACHE") }, + func() string { + return kit.Select(kit.HomePath("go")+nfs.PS, m.Cmdx(cli.SYSTEM, "go", "env", "GOPATH")) + "/pkg/mod/" + }, + func() string { + return ice.USR_REQUIRE + }, + ), path.Join(arg...)) if !nfs.Exists(m, p) { if p = path.Join(ice.USR_REQUIRE, path.Join(arg...)); !nfs.Exists(m, p) { ls := strings.SplitN(path.Join(arg[:3]...), mdb.AT, 2)