File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed
Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -461,6 +461,7 @@ impl ArchiveFile {
461461 let archive_name = archive_path. file_name ( ) . unwrap ( ) . to_str ( ) . unwrap ( ) ;
462462 for ( regex, archivetype) in [
463463 ( Regex :: new ( r"^(.+)\.tar\.gz$" ) . unwrap ( ) , ArchiveType :: TarGz ) ,
464+ ( Regex :: new ( r"^(.+)\.tar\.xz$" ) . unwrap ( ) , ArchiveType :: TarXz ) ,
464465 ( Regex :: new ( r"^(.+)\.zip$" ) . unwrap ( ) , ArchiveType :: Zip ) ,
465466 ] {
466467 if regex. is_match ( archive_name) {
@@ -500,9 +501,9 @@ impl ArchiveFile {
500501 }
501502 //根据压缩文件的类型生成cmd指令
502503 match & self . archive_type {
503- ArchiveType :: TarGz => {
504+ ArchiveType :: TarGz | ArchiveType :: TarXz => {
504505 let mut cmd = Command :: new ( "tar" ) ;
505- cmd. arg ( "-xzf " ) . arg ( & self . archive_name ) ;
506+ cmd. arg ( "-xf " ) . arg ( & self . archive_name ) ;
506507 let proc: std:: process:: Child = cmd
507508 . current_dir ( path)
508509 . stderr ( Stdio :: piped ( ) )
@@ -575,6 +576,7 @@ impl ArchiveFile {
575576
576577pub enum ArchiveType {
577578 TarGz ,
579+ TarXz ,
578580 Zip ,
579581 Undefined ,
580582}
You can’t perform that action at this time.
0 commit comments