1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
use std::path::Path;
use zip::ZipWriter;
use zip_extensions::write::ZipWriterExtensions;
pub fn write(source_path: &Path, archive_file: &Path) -> zip::result::ZipResult<()> {
let file = std::fs::File::create(archive_file)?;
let mut zip = ZipWriter::new(file);
zip.create_from_directory(&source_path.to_path_buf())?;
Ok(())
}
pub fn dirs_to_write(source_path: &Path) -> fs_extra::error::Result<()> {
let path = source_path.join("AndroidManifest.xml");
if path.exists() {
let manifest_path = source_path.join("manifest");
if !manifest_path.exists() {
std::fs::create_dir_all(&manifest_path)?;
}
let mut options = fs_extra::file::CopyOptions::new();
options.overwrite = true;
fs_extra::file::move_file(&path, &manifest_path.join("AndroidManifest.xml"), &options)?;
}
Ok(())
}