Skip to content

Commit

Permalink
chore: update sierra file stem (#45)
Browse files Browse the repository at this point in the history
* update sierra file stem

* support .sierra for backwards compat

* fix clippy
  • Loading branch information
tserg authored Sep 18, 2023
1 parent 2f51013 commit 8dc26ae
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions src/compilation/scarb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,21 @@ pub fn compile(opts: CoreOpts) -> Result<Vec<ProgramCompiled>> {
let mut sierra_files_path = vec![];

if let Ok(entries) = fs::read_dir(opts.target.as_path().join(Path::new("target/dev"))) {
let accepted_formats = [
// For scarb <= 0.7.0
".sierra",
".contract_class",
];
for entry in entries.flatten() {
if entry
.path()
.file_stem()
.unwrap()
.to_str()
.unwrap()
.ends_with(".sierra")
{
if accepted_formats.iter().any(|f| {
entry
.path()
.file_stem()
.unwrap()
.to_str()
.unwrap()
.ends_with(*f)
}) {
sierra_files_path.push(entry.path());
}
}
Expand Down

0 comments on commit 8dc26ae

Please sign in to comment.