openAbsolute should strip out the volume name on Windows
This commit is contained in:
parent
4e6103418c
commit
1c61235b63
|
@ -108,6 +108,13 @@ func (resolver *Resolver) ResolveCwd (address entity.Address) (string, error) {
|
|||
// paths, which the FSPL compiler runs on. It converts an absolute path to a
|
||||
// slash path relative to "/" and opens the file.
|
||||
func openAbsolute (filesystem fs.FS, path string) (fs.File, error) {
|
||||
path = strings.TrimPrefix(filepath.ToSlash(path), "/")
|
||||
rootName := "/"
|
||||
// FIXME: this does not distinguish between volumes on windows. this is
|
||||
// a limitation of os.DirFS, we might want our own DirFS implementation
|
||||
// that has volumes as subdirs of /.
|
||||
if volumeName := filepath.VolumeName(path); volumeName != "" {
|
||||
rootName = volumeName
|
||||
}
|
||||
path = strings.TrimPrefix(filepath.ToSlash(path), rootName)
|
||||
return filesystem.Open(path)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue