mirror of
https://github.com/ALEZ-DEV/Babylonia-terminal.git
synced 2026-03-21 21:58:52 +00:00
handle decompressing error
This commit is contained in:
parent
727125f603
commit
2562451cbe
@ -105,21 +105,20 @@ impl<'a> ComponentDownloader for DXVKComponent<'a> {
|
|||||||
file: std::path::PathBuf,
|
file: std::path::PathBuf,
|
||||||
new_directory_name: std::path::PathBuf,
|
new_directory_name: std::path::PathBuf,
|
||||||
) -> anyhow::Result<()> {
|
) -> anyhow::Result<()> {
|
||||||
tokio::task::spawn_blocking(move || {
|
tokio::task::spawn_blocking(move || -> anyhow::Result<()> {
|
||||||
let tar_gz = File::open(file.clone()).unwrap();
|
let tar_gz = File::open(file.clone())?;
|
||||||
let tar = GzDecoder::new(tar_gz);
|
let tar = GzDecoder::new(tar_gz);
|
||||||
let mut archive = Archive::new(tar);
|
let mut archive = Archive::new(tar);
|
||||||
archive
|
archive.unpack(new_directory_name.parent().unwrap())?;
|
||||||
.unpack(new_directory_name.parent().unwrap())
|
remove_file(file.clone())?;
|
||||||
.unwrap();
|
|
||||||
remove_file(file.clone()).unwrap();
|
|
||||||
rename(
|
rename(
|
||||||
file.to_str().unwrap().strip_suffix(".tar.gz").unwrap(),
|
file.to_str().unwrap().strip_suffix(".tar.gz").unwrap(),
|
||||||
new_directory_name,
|
new_directory_name,
|
||||||
)
|
)?;
|
||||||
.unwrap()
|
|
||||||
|
Ok::<(), anyhow::Error>(())
|
||||||
})
|
})
|
||||||
.await?;
|
.await??;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user