account for non-unix filepaths

This commit is contained in:
Alexander Wang 2024-09-23 07:20:52 -06:00
parent 5df045ca78
commit b070ab6696
No known key found for this signature in database
GPG key ID: BE3937D0D52D8927

View file

@ -4,6 +4,7 @@ import (
"io/fs"
"os"
"path"
"path/filepath"
"strings"
"oss.terrastruct.com/d2/d2ast"
@ -21,7 +22,7 @@ func (c *compiler) pushImportStack(imp *d2ast.Import) (string, bool) {
impPath += ".d2"
}
if !path.IsAbs(impPath) {
if !filepath.IsAbs(impPath) {
impPath = path.Join(path.Dir(c.importStack[len(c.importStack)-1]), impPath)
}
}