Skip to content

fix: add symlink support in the new project template cargo miden new#1005

Open
greenhat wants to merge 2 commits intonextfrom
i1002-symlinks-new-project-template
Open

fix: add symlink support in the new project template cargo miden new#1005
greenhat wants to merge 2 commits intonextfrom
i1002-symlinks-new-project-template

Conversation

@greenhat
Copy link
Contributor

Close #1002

@greenhat greenhat marked this pull request as ready for review March 12, 2026 13:45
@greenhat greenhat requested a review from bitwalker March 12, 2026 13:45
/// 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")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure. Done in 34ffc86

Copy link
Collaborator

@bitwalker bitwalker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.
@greenhat
Copy link
Contributor Author

Thank you! Done and ready for another round.

@greenhat greenhat requested a review from bitwalker March 16, 2026 13:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Symlink support in the new project template in the cargo miden new command

2 participants