diff options
| author | Ophestra <cat@gensokyo.uk> | 2026-05-21 14:07:20 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2026-05-21 14:07:20 +0900 |
| commit | 443a7a30f618c32fea6e564f0fcf0822a0d43538 (patch) | |
| tree | 8b52b0e75d9b00e3a560179eef800cdd62015107 /internal/rosa/state.go | |
| parent | 497e4a564200dd51fdd950e1b83e7a5722e74a4c (diff) | |
internal/rosa: use string pair for files
This is a much cleaner representation than the separator syntax.
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'internal/rosa/state.go')
| -rw-r--r-- | internal/rosa/state.go | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/internal/rosa/state.go b/internal/rosa/state.go index 6142e4ac..6ff6f1cf 100644 --- a/internal/rosa/state.go +++ b/internal/rosa/state.go @@ -899,7 +899,7 @@ func (ctx *evalContext) pf( var ( attr PackageAttr patches []string - files []string + files []KV excl bool early bool @@ -965,16 +965,17 @@ func (ctx *evalContext) pf( for _, pair := range files { var pathname *check.Absolute - dst, src, ok := strings.Cut(pair, ":") - if !ok { - src, dst = dst, filepath.Base(dst) + if pathname, err = check.NewAbs(pair[0]); err != nil { + pathname = AbsUsrSrc.Append(pair[0]) + err = nil } - if pathname, err = check.NewAbs(dst); err != nil { - pathname = AbsUsrSrc.Append(dst) + + if pair[1] == "" { + pair[1] = pair[0] } var p []byte - p, err = fs.ReadFile(ctx.b, src) + p, err = fs.ReadFile(ctx.b, pair[1]) if err != nil { return } @@ -982,8 +983,8 @@ func (ctx *evalContext) pf( attr.Paths = append(attr.Paths, pkg.Path( pathname, false, - pkg.NewFile(filepath.Base(dst), p), - )) + pkg.NewFile(filepath.Base(pair[0]), p)), + ) } if excl { |
