feat: the other profile buttons

This commit is contained in:
2025-03-14 00:23:47 +00:00
parent fd27000c05
commit 90ba27c967
11 changed files with 112 additions and 33 deletions

View File

@ -66,15 +66,19 @@ pub fn pkg_dir_of(namespace: &str, name: &str) -> PathBuf {
pkg_dir().join(format!("{}-{}", namespace, name))
}
pub fn copy_recursive(src: &Path, dst: &Path) -> std::io::Result<()> {
std::fs::create_dir_all(&dst).unwrap();
for entry in std::fs::read_dir(src)? {
pub fn copy_directory(src: impl AsRef<Path>, dst: impl AsRef<Path>, recursive: bool) -> std::io::Result<()> {
std::fs::create_dir_all(dst.as_ref()).unwrap();
for entry in std::fs::read_dir(src.as_ref())? {
let entry = entry?;
let meta = entry.metadata()?;
if meta.is_dir() {
copy_recursive(&entry.path(), &dst.join(entry.file_name()))?;
if recursive == true {
copy_directory(&entry.path(), &dst.as_ref().join(entry.file_name()), true)?;
} else {
log::warn!("Skipping directory {:?}", meta);
}
} else {
std::fs::copy(&entry.path(), &dst.join(entry.file_name()))?;
std::fs::copy(&entry.path(), &dst.as_ref().join(entry.file_name()))?;
}
}
Ok(())