Skip to content

Commit

Permalink
use fs_extra to avoid fs errors on ci
Browse files Browse the repository at this point in the history
  • Loading branch information
katat committed Nov 7, 2024
1 parent 4f4c05d commit a53967e
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 26 deletions.
7 changes: 7 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ description = "a programming language for writing zkapps"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[build-dependencies]
fs_extra = "1.3.0"
dirs = "4.0"

[dependencies]
Expand Down
37 changes: 12 additions & 25 deletions build.rs
Original file line number Diff line number Diff line change
@@ -1,23 +1,6 @@
use std::{
env, fs,
path::{Path, PathBuf},
};
use std::{env, path::PathBuf};

// Copy a folder recursively
fn copy_recursively(src: &Path, dst: &Path) -> std::io::Result<()> {
if src.is_dir() {
fs::create_dir_all(dst)?;
for entry in fs::read_dir(src)? {
let entry = entry?;
let entry_path = entry.path();
let dest_path = dst.join(entry.file_name());
copy_recursively(&entry_path, &dest_path)?;
}
} else {
fs::copy(src, dst)?;
}
Ok(())
}
use fs_extra::dir::{self, CopyOptions};

fn main() {
let home_dir: PathBuf =
Expand All @@ -26,15 +9,19 @@ fn main() {
let noname_dir = home_dir.join(".noname");
let release_dir = noname_dir.join("release");

// if it exists, then revmove it
// If it exists, then remove it
if release_dir.exists() {
fs::remove_dir_all(&release_dir).expect("could not remove release directory");
fs_extra::remove_items(&[&release_dir]).expect("could not remove release directory");
}

// copy the current folder to the release directory
fs::create_dir_all(&release_dir).expect("could not create release directory");

let current_dir = env::current_dir().expect("could not get current directory");
copy_recursively(&current_dir, &release_dir)

// Set up copy options
let mut options = CopyOptions::new();
options.overwrite = true; // Overwrite existing files
options.copy_inside = true; // Copy contents inside the source directory

// Copy the current folder to the release directory
dir::copy(current_dir, &release_dir, &options)
.expect("could not copy current directory to release directory");
}
2 changes: 1 addition & 1 deletion src/backends/kimchi/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -771,6 +771,6 @@ impl Backend for KimchiVesta {
msg: String,
span: Span,
) {
todo!()
println!("todo: implement log_var for kimchi backend");
}
}

0 comments on commit a53967e

Please sign in to comment.