emilk / eframe_template

The easy way to make a Rust app with a GUI
Apache License 2.0
823 stars 181 forks source link

fill_template.sh fails on macOS #164

Open msgilligan opened 2 months ago

msgilligan commented 2 months ago

The fill_template.sh does not work with the built-in sed command on macOS (/usr/bin/sed) and produces the following error:

Patching files...
sed: 1: "Cargo.toml": invalid command code C

I worked around the issue by installing the Nix package gnused. Once that version of sed is first in my $PATH fill_template.sh works correctly.

c-git commented 2 months ago

I had redone the template in rust so no sed needed and had decided it maybe wasn't worth it as it wasn't that much better than the script. But I can revisit given considering cross platform, if that is actually helpful to someone other than me.

msgilligan commented 2 months ago

At the very least you could just document that macOS users need to install GNU sed. It was pretty easy to figure out, but a comment in the script or elsewhere would IMO resolve this issue and might be simpler than publishing a Rust version.

c-git commented 2 months ago

TLDR

I suspect the original author may not have had experience with macOS and thus didn't know of the differences between the versions of sed. I think the simplest next step is to add a comment as you suggested.

Problems with that solution

But there is also another version that had to be done for windows https://github.com/emilk/eframe_template/pull/153 and now technically we've doubled the number of versions to be maintained along with needing a comment about versions of sed.

Problems I can think of with a rust solution

Rust scripts haven't been stabilized yet and would require nightly to run them. Otherwise I think they would be similar level of difficulty to doing a rust script compared with the current script.

The other option is doing a cargo subcommand but that would require the user to install a binary instead of just run a script again probably not worthwhile unless you start a lot of new projects.

My previous attempt (that I think missed the mark in some regards)

The main reason I didn't make a PR for the version I did was because my information doesn't change much between projects and thus I did something a bit more complicated (which in hindsight was maybe a bit too complicated) that would reuse information. The current version of what I did is online but I do not think it works well yet for the general case.