diff --git a/base/nfs/dir.go b/base/nfs/dir.go index 54bed18d..4b4cdaac 100644 --- a/base/nfs/dir.go +++ b/base/nfs/dir.go @@ -20,6 +20,32 @@ func _dir_list(m *ice.Message, root string, name string, level int, deep bool, d return m // 没有权限 } + if len(ice.Info.Pack) > 0 && name != ice.USR { + for k, b := range ice.Info.Pack { + p := strings.TrimPrefix(k, root) + if !strings.HasPrefix(p, name) { + if p = strings.TrimPrefix(k, root+ice.PS); !strings.HasPrefix(p, name) { + if p = strings.TrimPrefix(k, ice.PS); !strings.HasPrefix(p, name) { + continue + } + } + } + + m.Debug("cat binpack %s", p) + for _, field := range fields { + switch field { + case PATH: + m.Push(field, p) + case SIZE: + m.Push(field, len(b)) + default: + m.Push(field, "") + } + } + } + return m + } + list, e := ioutil.ReadDir(path.Join(root, name)) if e != nil { // 单个文件 ls, _ := ioutil.ReadDir(path.Dir(path.Join(root, name))) diff --git a/core/code/binpack.go b/core/code/binpack.go index 716581ee..95e50772 100644 --- a/core/code/binpack.go +++ b/core/code/binpack.go @@ -103,6 +103,21 @@ func init() { m.Logs(BINPACK, len(b), name) return b // 打包文件 } + if b, ok := ice.Info.Pack[strings.TrimPrefix(name, ice.USR_VOLCANOS)]; ok && len(b) > 0 { + m.Debug("cat binpack %s", name) + m.Logs(BINPACK, len(b), name) + return b // 打包文件 + } + if b, ok := ice.Info.Pack[path.Join(m.Option(nfs.DIR_ROOT), name)]; ok && len(b) > 0 { + m.Debug("cat binpack %s", name) + m.Logs(BINPACK, len(b), name) + return b // 打包文件 + } + if b, ok := ice.Info.Pack[path.Join(ice.PS, name)]; ok && len(b) > 0 { + m.Debug("cat binpack %s", name) + m.Logs(BINPACK, len(b), name) + return b // 打包文件 + } return nil }) }},