diff options
| author | Ophestra <cat@gensokyo.uk> | 2026-11-01 00:49:56 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2026-11-01 00:49:56 +0900 |
| commit | c7f7b5e80349916743454f96880f2b16539cc97c (patch) | |
| tree | 4e65c12de8f4eacf4cb95ca1fa53337a96c90406 /internal/rosa | |
| parent | aaeefb7be7a6b59810be514d6c40159f40761f0d (diff) | |
internal/rosa: do not hard code filename prefix
The hardcoded name is not correct for externally registered files.
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'internal/rosa')
| -rw-r--r-- | internal/rosa/builtins.go | 2 | ||||
| -rw-r--r-- | internal/rosa/state.go | 6 |
2 files changed, 5 insertions, 3 deletions
diff --git a/internal/rosa/builtins.go b/internal/rosa/builtins.go index edca2333..bca69a03 100644 --- a/internal/rosa/builtins.go +++ b/internal/rosa/builtins.go @@ -135,7 +135,7 @@ func init() { panic(err) } t := time.Now() - if err = builtin.RegisterFS(sub); err != nil { + if err = builtin.RegisterFS(sub, "internal/rosa/package/"); err != nil { println(err.Error()) os.Exit(1) } diff --git a/internal/rosa/state.go b/internal/rosa/state.go index dc1b3109..c236ee6d 100644 --- a/internal/rosa/state.go +++ b/internal/rosa/state.go @@ -1355,13 +1355,15 @@ func (s *S) RegisterAzalea(r io.Reader, name string, b fs.FS) error { // evaluated if it is at the top level and its name has the suffix ".az", or it // is in a top-level directory with the exact file name "package.az". The // backing filesystem is directly exposed to azalea pathnames. -func (s *S) RegisterFS(fsys fs.FS) error { +// +// The prefix string is only used for position information and must use forward +// slashes as its path separator and end with a path separator. +func (s *S) RegisterFS(fsys fs.FS, prefix string) error { dents, err := fs.ReadDir(fsys, ".") if err != nil { return err } - const prefix = "internal/rosa/package/" var r fs.File for _, dent := range dents { if dent.IsDir() { |
