Zips a folder
(zip_file_name: PathBuf, folder_path: &PathBuf)
| 51 | |
| 52 | /// Zips a folder |
| 53 | pub fn zip_debug_folder(zip_file_name: PathBuf, folder_path: &PathBuf) -> std::io::Result<()> { |
| 54 | // Delete the zip file if it already exists |
| 55 | if zip_file_name.exists() { |
| 56 | std::fs::remove_file(&zip_file_name)?; |
| 57 | } |
| 58 | let zip_file = File::create(&zip_file_name)?; |
| 59 | let mut zip_writer = ZipWriter::new(BufWriter::new(zip_file)); |
| 60 | |
| 61 | for entry in walkdir::WalkDir::new(folder_path) { |
| 62 | let entry = entry?; |
| 63 | let path = entry.path(); |
| 64 | |
| 65 | if path.is_file() { |
| 66 | zip_writer.start_file(path.to_string_lossy(), SimpleFileOptions::default())?; |
| 67 | let mut file = File::open(path)?; |
| 68 | copy(&mut file, &mut zip_writer)?; |
| 69 | } |
| 70 | } |
| 71 | |
| 72 | zip_writer.finish()?; |
| 73 | Ok(()) |
| 74 | } |
| 75 | |
| 76 | pub async fn get_k8s_auth_mode( |
| 77 | mz_username: Option<String>, |