Skip to content

Commit

Permalink
Fix/init template base contract Cargo.toml (#1235)
Browse files Browse the repository at this point in the history
Rename init template hello_world Cargo.toml to Cargo.toml.removeextension
  • Loading branch information
elizabethengelman authored Mar 5, 2024
1 parent d2759c2 commit 187e98c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
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

0 comments on commit 187e98c

Please sign in to comment.