Skip to content

Commit

Permalink
fix: ensure sozo clean only affect base (#1685)
Browse files Browse the repository at this point in the history
The overlays are managed by the user. We don't want to clean them.
The deployments are only output, and can't cause any conflict.
For this reason, only base should be clean.
  • Loading branch information
glihm authored Mar 22, 2024
1 parent 1bed704 commit 7bddd4a
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions bin/sozo/src/commands/clean.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::fs;
use anyhow::Result;
use camino::Utf8PathBuf;
use clap::Args;
use dojo_lang::compiler::{ABIS_DIR, MANIFESTS_DIR};
use dojo_lang::compiler::{ABIS_DIR, BASE_DIR, MANIFESTS_DIR};
use scarb::core::Config;

#[derive(Debug, Args)]
Expand All @@ -21,15 +21,15 @@ pub struct CleanArgs {

impl CleanArgs {
pub fn clean_manifests_abis(&self, root_dir: &Utf8PathBuf) -> Result<()> {
let manifest_dir = root_dir.join(MANIFESTS_DIR);
let abis_dir = root_dir.join(ABIS_DIR);

if manifest_dir.exists() {
fs::remove_dir_all(manifest_dir)?;
}

if abis_dir.exists() {
fs::remove_dir_all(abis_dir)?;
let dirs = vec![
root_dir.join(MANIFESTS_DIR).join(BASE_DIR),
root_dir.join(ABIS_DIR).join(BASE_DIR),
];

for d in dirs {
if d.exists() {
fs::remove_dir_all(d)?;
}
}

Ok(())
Expand Down

0 comments on commit 7bddd4a

Please sign in to comment.