-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
installer: add support for 7Zip archives (#235)
- Loading branch information
1 parent
18e5628
commit dd53499
Showing
5 changed files
with
42 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
use crate::installer::archive_installer::ArchiveInstaller; | ||
use crate::installer::command::exec_command; | ||
use crate::installer::destination::Destination; | ||
use crate::installer::error::InstallError; | ||
use crate::installer::executable::Executable; | ||
use crate::installer::file::SupportedFileInfo; | ||
use crate::installer::result::InstallerResult; | ||
use std::path::Path; | ||
use std::process::Command; | ||
|
||
const _7Z: &str = "7z"; | ||
|
||
pub struct SevenZipArchiveInstaller; | ||
|
||
impl SevenZipArchiveInstaller { | ||
pub fn run( | ||
file_info: SupportedFileInfo, | ||
destination: Destination, | ||
executable: &Executable, | ||
) -> InstallerResult { | ||
ArchiveInstaller::run(Self::extract_archive, file_info, destination, executable) | ||
} | ||
|
||
fn extract_archive(source: &Path, temp_dir: &Path) -> Result<(), InstallError> { | ||
exec_command( | ||
_7Z, | ||
Command::new(_7Z) | ||
.arg("x") | ||
.arg(source) | ||
.arg(format!("-o{}", temp_dir.display())), | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters