mirror of
https://github.com/ALEZ-DEV/Babylonia-terminal.git
synced 2025-12-15 17:08:51 +00:00
return Result<()> instead of unwrap() when decompressing to catch the error
This commit is contained in:
parent
4d07600ea6
commit
7ed53c752f
@ -81,18 +81,16 @@ impl ComponentDownloader for ProtonComponent {
|
||||
let tar_xz = File::open(file.clone()).unwrap();
|
||||
let tar = GzDecoder::new(tar_xz);
|
||||
let mut archive = Archive::new(tar);
|
||||
archive
|
||||
.unpack(new_directory_name.parent().unwrap())
|
||||
.unwrap();
|
||||
remove_file(file.clone()).unwrap();
|
||||
archive.unpack(new_directory_name.parent().unwrap())?;
|
||||
remove_file(file.clone())?;
|
||||
rename(
|
||||
file.to_str().unwrap().strip_suffix(".tar.gz").unwrap(),
|
||||
new_directory_name,
|
||||
)
|
||||
.unwrap();
|
||||
)?;
|
||||
|
||||
Ok::<(), anyhow::Error>(())
|
||||
})
|
||||
.await
|
||||
.unwrap();
|
||||
.await??;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user