pub fn make_archive(
        &self,
        src: impl AsRef<Path>,
        to: impl AsRef<Path>,
    ) -> anyhow::Result<Option<PathBuf>> {
        match self {
            ArchiveMode::Tar => {
                let to = PathBuf::from(format!("{}.tar.gz", to.as_ref().display()));
                let file = File::create(&to)?;
                make_tarball(src, file)?;
                Ok(Some(to))
            }
            ArchiveMode::Zip => {
                let src = src.as_ref();
                let to = PathBuf::from(format!("{}.zip", to.as_ref().display()));
                let file = File::create(&to)?;
                let walkdir = WalkDir::new(src);
                let it = walkdir.into_iter();

                zip_dir(&mut it.filter_map(|e| e.ok()), src, file)?;
                Ok(Some(to))
            }
            ArchiveMode::Skip => Ok(None),
        }
    }
/// Create either a tar or zip file of the provided source path
Create either a tar or zip file of the provided source path
Create either a tar or zip file of the provided source path
pub fn make_archive(
        &self,
        src: impl AsRef<Path>,
        to: impl AsRef<Path>,
    ) -> anyhow::Result<Option<PathBuf>> {
        match self {
            ArchiveMode::Tar => {
                let to = PathBuf::from(format!("{}.tar.gz", to.as_ref().display()));
                let file = File::create(&to)?;
                make_tarball(src, file)?;
                Ok(Some(to))
            }
            ArchiveMode::Zip => {
                let src = src.as_ref();
                let to = PathBuf::from(format!("{}.zip", to.as_ref().display()));
                let file = File::create(&to)?;
                let walkdir = WalkDir::new(src);
                let it = walkdir.into_iter();
                zip_dir(&mut it.filter_map(|e| e.ok()), src, file)?;
                Ok(Some(to))
            }
            ArchiveMode::Skip => Ok(None),
        }
    }
pub fn make_archive ( & self , src : impl AsRef < Path > , to : impl AsRef < Path > , ) -> anyhow :: Result < Option < PathBuf > > { match self { ArchiveMode :: Tar => { let to = PathBuf :: from ( format ! ( " " to as_ref ( ) display ( ) ) ) ; let file = File :: create ( & to ) ? ; make_tarball ( src , file ) ? ; Ok ( Some ( to ) ) } ArchiveMode :: Zip => { let src = src . as_ref ( ) ; let to = PathBuf :: from ( format ! ( " " to as_ref ( ) display ( ) ) ) ; let file = File :: create ( & to ) ? ; let walkdir = WalkDir :: new ( src ) ; let it = walkdir . into_iter ( ) ; zip_dir ( & mut it . filter_map ( | e | e . ok ( ) ) , src , file ) ? ; Ok ( Some ( to ) ) } ArchiveMode :: Skip => Ok ( None ) , } }
Create either a tar or zip file of the provided source path
Create either a tar or zip file of the provided source path
&self
src
impl AsRef<Path>
to
impl AsRef<Path>
&self
src
impl AsRef<Path>
to
impl AsRef<Path>