Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: absolute import support #1397

Closed
bo-ku-ra opened this issue Jun 10, 2023 · 9 comments · Fixed by #2113
Closed

Feature request: absolute import support #1397

bo-ku-ra opened this issue Jun 10, 2023 · 9 comments · Fixed by #2113

Comments

@bo-ku-ra
Copy link
Contributor

when importing d2-file that define 'style' and 'classes', absolute path is better than relative path.

move "cccc.d2" "./bar/cccc.d2"

├─d2
│ │ bokura-config.d2
│ │
│ └─foo
│  │ aaaaa.d2 (classes{ ...@../bokura-config.classes })
│  │ bbbbb.d2 (classes{ ...@../bokura-config.classes })
│  │ (ccccc.d2) <-OK
│  │
│  └─bar
│   ccccc.d2 (classes{ ...@../bokura-config.classes }) <- NG (../../ <-OK)

@cyborg-ts cyborg-ts added this to D2 Jun 10, 2023
@bo-ku-ra
Copy link
Contributor Author

i may want to put 'bokura-config.d2' on a network drive when i share it with my colleagues.

@bo-ku-ra
Copy link
Contributor Author

doesn't it work on v0.6.0?

@alixander
Copy link
Collaborator

unfortunately not, didn't get to it

@tylerhartwig
Copy link

Just wanted to add a comment and say this is something I'd really appreciate from D2 as well, for similar reasons as the classes and style imports.

I'd also like to organize pieces of my diagrams in separate files, and then import them into the relevant diagram to avoid redundancies. Absolute imports would make this much easier and avoid the need to update relative paths if I were to change my directory structure

@alixander
Copy link
Collaborator

This will be in the next release, thank you all for patience

@bo-ku-ra
Copy link
Contributor Author

is this not supported on 'windows'?

@alixander
Copy link
Collaborator

@bo-ku-ra it should, though I haven't tested it specifically. what are you seeing?

@bo-ku-ra
Copy link
Contributor Author

bo-ku-ra commented Oct 11, 2024

@alixander am I wrong?

C:\
└─d2
 │ bokura-config.d2
 │
 └─foo
    a.d2 ( ...@c:\d2\bokura-config ) # NG
    b.d2 ( ...@c:/d2/bokura-config )  # NG
    c.d2 ( ...@../bokura-config ) # OK

...@/ <----- where is '/ ' in windows?

@alixander
Copy link
Collaborator

i made an issue to test this, will do #2149

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants