diff --git a/compiler/resolver.go b/compiler/resolver.go index 1969150..30df7bc 100644 --- a/compiler/resolver.go +++ b/compiler/resolver.go @@ -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) }