Compiler normalizes paths before passing them to an fs

This commit is contained in:
Sasha Koshka 2024-03-28 16:52:31 -04:00
parent e805060370
commit 4e6103418c
1 changed files with 2 additions and 3 deletions

View File

@ -106,9 +106,8 @@ func (resolver *Resolver) ResolveCwd (address entity.Address) (string, error) {
// openAbsolute exists because fs.FS implementations do not understand absolute
// paths, which the FSPL compiler runs on. It converts an absolute path to a
// path relative to "/" and opens the file.
// slash path relative to "/" and opens the file.
func openAbsolute (filesystem fs.FS, path string) (fs.File, error) {
path, err := filepath.Rel("/", path)
if err != nil { return nil, err }
path = strings.TrimPrefix(filepath.ToSlash(path), "/")
return filesystem.Open(path)
}