diff options
| author | Ophestra <cat@gensokyo.uk> | 2026-05-20 02:09:12 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2026-05-20 02:09:12 +0900 |
| commit | fcba32e9c4bc27a0cdcd1a78bbc1cf5ea799c18e (patch) | |
| tree | d1c13bc9f0a203785556b5ae0358d76656883b00 /internal/rosa/state.go | |
| parent | a7f5a5802d48d26aa2bddb9d98be8e5efdef9db0 (diff) | |
internal/rosa/package: migrate glib
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'internal/rosa/state.go')
| -rw-r--r-- | internal/rosa/state.go | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/internal/rosa/state.go b/internal/rosa/state.go index 3934fe38..ed1124fb 100644 --- a/internal/rosa/state.go +++ b/internal/rosa/state.go @@ -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), )) } |
