Imports on Windows are not relative to diagram path
According to https://d2lang.com/tour/imports/#imports-are-relative-to-that-file
Directory structure:
.
└── diagrams
├── architecture.d2
├── flow--queue.d2
└── styles.d2
flow--queue.d2 includes styles.d2 with:
...@styles
When I run d2 from the .\ directory, I get an error (... replaces project directory):
err: failed to compile diagrams\flow--queue.d2: ...\diagrams\flow--queue.d2:1:1: failed to import "styles.d2": open styles.d2: The system cannot find the file specified.
When I run d2 from the diagrams\ directory, it succeeds:
success: successfully compiled flow--queue.d2 to flow--queue.svg in 1.5866772s
I came across the same issue with icon import on Linux
@am-on wasn't running the right version. @andrewschmidgit were you running on latest version?
It's on v0.6.5
@andrewschmidgit Can you update and try on 0.6.6?
I am running on 0.6.8 and using a devcontainer in vscode on mac os and seem to having issues with this as well.
models
|-- assets
| |-- aws
| | |-- eks.svg
| | |-- nlb.svg
| | |-- subnet.svg
| | |-- vpc.svg
| | `-- vpce.svg
| |-- k8s
| | |-- deploy.svg
| | |-- istio.png
| | |-- k8s.svg
| | |-- ns.svg
| | |-- pod.svg
| | `-- svc.png
|-- aws.d2
|-- istio.d2
|-- k8s.d2
`-- position.d2
I reference icons like assets/k8s/svc.png
If I render models/aws.d2 directly then the icons work.
If I render cell-deply.d2 (that is in the root folder called diagrams above models) then I get the following errors:
err: failed to bundle ./assets/aws/eks.svg: open /workspaces/scratch-test/diagrams/assets/aws/eks.svg: no such file or directory
err: failed to bundle ./assets/aws/subnet.svg: open /workspaces/scratch-test/diagrams/assets/aws/subnet.svg: no such file or directory
err: failed to bundle ./assets/aws/vpc.svg: open /workspaces/scratch-test/diagrams/assets/aws/vpc.svg: no such file or directory
err: failed to compile cell-deploy.d2: failed to bundle local images: [./assets/aws/eks.svg ./assets/aws/subnet.svg ./assets/aws/vpc.svg]
So it still looks like the cell-deploy.d2 file is taking the raw icon path and not adding the models/ path before rendering...
Note I reference the models in the root diagrams like so:
vpc: @models/aws.vpc
vpc: {
az1: @models/aws.az
az2: @models/aws.az
az3: @models/aws.az
}
I have the same issue @andrewschmidgit in version 0.7.0