cargo-generate icon indicating copy to clipboard operation
cargo-generate copied to clipboard

Symlinks not generated from templates

Open bahildebrand opened this issue 3 years ago • 2 comments

Describe the bug Symlinks are not copied if they exist in a template, or are generated from a rhai script. I've tried both the symlink being present in the template, and generating one with rhai. The behavior with rhai is a bit different, as I see output indicating that the file was copied(i.ie [ 6/16] Done: path/to/symlink), while a symlink file present in the template does not.

Relevant Rhai snippet:

system::command("ln", ["-s", "/usr/bin/some-bin", "path/to/symlink])

At first I thought they might be failing since I'm creating a link outside of the template directory, but even creating links local to the template do not seem to copy properly.

make sure you

  • [X] I'm on the latest rust version rustup update
  • [X] I'm on the latest cargo-generate version cargo install cargo-generate

To Reproduce Steps to reproduce the behavior:

  1. cargo generate -a -p template_dir - with symlink present in template

Expected behavior Symlinks copied to template output

Desktop (please complete the following information):

  • OS: Fedora
  • Version: 36
  • Build tools: cargo
  • Shell: zsh
  • rustc --version: 1.65
  • cargo generate --version: 0.16.0

bahildebrand avatar Nov 03 '22 19:11 bahildebrand

I am experiencing similar behavior, I have a template that has a symlinked directory in it, I would like the directory and its contents to end up in the project that cargo-generate produces. I have tried adding explicit include entries for each of the files in the symlinked folder, an explicit include for the folder itself, nothing seems to work. I also don't get a warning when I generate a project from the template.

rustc 1.65.0 (897e37553 2022-11-02)
cargo generate 0.17.3

x37v avatar Dec 02 '22 18:12 x37v