Dinh Long Nguyen e1c8d98bf2
Backend Architecture Refactoring (#6094) (#6162)
* add llamacpp plugin

* Refactor llamacpp plugin

* add utils plugin

* remove utils folder

* add hardware implementation

* add utils folder + move utils function

* organize cargo files

* refactor utils src

* refactor util

* apply fmt

* fmt

* Update gguf + reformat

* add permission for gguf commands

* fix cargo test windows

* revert yarn lock

* remove cargo.lock for hardware plugin

* ignore cargo.lock file

* Fix hardware invoke + refactor hardware + refactor tests, constants

* use api wrapper in extension to invoke hardware call + api wrapper build integration

* add newline at EOF (per Akarshan)

* add vi mock for getSystemInfo
2025-08-15 08:59:01 +07:00

36 lines
909 B
Rust

use std::fs;
use std::io;
use std::path::PathBuf;
/// Recursively copies directories with exclusion support
pub fn copy_dir_recursive(
src: &PathBuf,
dst: &PathBuf,
exclude_dirs: &[&str],
) -> Result<(), io::Error> {
if !dst.exists() {
fs::create_dir_all(dst)?;
}
for entry in fs::read_dir(src)? {
let entry = entry?;
let file_type = entry.file_type()?;
let src_path = entry.path();
let dst_path = dst.join(entry.file_name());
if file_type.is_dir() {
// Skip excluded directories
if let Some(dir_name) = entry.file_name().to_str() {
if exclude_dirs.contains(&dir_name) {
continue;
}
}
copy_dir_recursive(&src_path, &dst_path, exclude_dirs)?;
} else {
fs::copy(&src_path, &dst_path)?;
}
}
Ok(())
}