internal/rosa/package: migrate glib

Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
2026-05-20 02:09:12 +09:00
parent a7f5a5802d
commit fcba32e9c4
6 changed files with 50 additions and 66 deletions

View File

@@ -18,6 +18,7 @@ import (
"unique"
"unsafe"
"hakurei.app/check"
"hakurei.app/internal/pkg"
"hakurei.app/internal/rosa/azalea"
)
@@ -919,21 +920,25 @@ func (ctx *evalContext) pf(
}
for _, pair := range files {
base, pathname, ok := strings.Cut(pair, ":")
var pathname *check.Absolute
dst, src, ok := strings.Cut(pair, ":")
if !ok {
pathname, base = base, filepath.Base(base)
src, dst = dst, filepath.Base(dst)
}
if pathname, err = check.NewAbs(dst); err != nil {
pathname = AbsUsrSrc.Append(dst)
}
var p []byte
p, err = fs.ReadFile(ctx.b, pathname)
p, err = fs.ReadFile(ctx.b, src)
if err != nil {
return
}
attr.Paths = append(attr.Paths, pkg.Path(
AbsUsrSrc.Append(base),
pathname,
false,
pkg.NewFile(base, p),
pkg.NewFile(filepath.Base(dst), p),
))
}