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

Fix/init template base contract Cargo.toml #1235

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions cmd/soroban-cli/src/commands/contract/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -208,9 +208,11 @@ fn copy_template_files(project_path: &Path) -> Result<(), Error> {
e
})?;

// We need to include the Cargo.toml file as Cargo.text in the template so that it will be included the package. This is making sure that the Cargo file is written as Cargo.toml in the new project. This is a workaround for this issue: https://github.com/rust-lang/cargo/issues/8597.
if item == "Cargo.toml.removeextension" {
to = project_path.join("Cargo.toml");
// We need to include the Cargo.toml file as Cargo.toml.removeextension in the template so that it will be included the package. This is making sure that the Cargo file is written as Cargo.toml in the new project. This is a workaround for this issue: https://github.com/rust-lang/cargo/issues/8597.
let item_path = Path::new(item.as_ref());
if item_path.file_name().unwrap() == "Cargo.toml.removeextension" {
let item_parent_path = item_path.parent().unwrap();
to = project_path.join(item_parent_path).join("Cargo.toml");
}

println!("➕ Writing {}", &to.to_string_lossy());
Expand Down
Loading