fix: add symlink support in the new project template cargo miden new#1005
Open
fix: add symlink support in the new project template cargo miden new#1005
cargo miden new#1005Conversation
bitwalker
reviewed
Mar 12, 2026
tools/cargo-miden/src/template.rs
Outdated
| /// Creates a symlink at `destination` that points to `target`. | ||
| #[cfg(not(unix))] | ||
| fn create_symlink(_source: &Path, _target: &Path, _destination: &Path) -> Result<()> { | ||
| bail!("Template symlink recreation is only supported on Unix platforms") |
Collaborator
There was a problem hiding this comment.
I would suggest we make a copy of the file on non-Unix targets, and maybe add a version for Windows that uses hardlinks - but we probably shouldn't support anything in templates that doesn't at least work on all targets where cargo miden may be run. We don't really properly support Windows at the moment (at least not intentionally), but we will need to eventually.
bitwalker
approved these changes
Mar 12, 2026
Collaborator
bitwalker
left a comment
There was a problem hiding this comment.
Looks good! Just one note about making sure we at least do something reasonable on systems without symlinks, since I don't think it makes sense to allow anything in a template that we can't support on all targets.
Keep Unix symlink recreation unchanged, but materialize symlink targets on non-Unix platforms instead of failing. Windows now prefers hardlinks for file targets and falls back to copying, while other non-Unix targets copy the resolved target contents.
Contributor
Author
|
Thank you! Done and ready for another round. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Close #1002