1
0
mirror of https://shylinux.com/x/icebergs synced 2025-05-03 12:07:00 +08:00
This commit is contained in:
harveyshao 2022-02-14 16:04:15 +08:00
parent 8d82f56bf9
commit 6004693ca4
2 changed files with 41 additions and 0 deletions

View File

@ -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)))

View File

@ -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
})
}},