Skip to content

Commit

Permalink
fix: 修复单测问题
Browse files Browse the repository at this point in the history
  • Loading branch information
Cnotech committed Aug 5, 2024
1 parent 8e8164f commit d6e7879
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/compression/tar.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use anyhow::Result;
use anyhow::{anyhow, Result};
use std::fs::{create_dir_all, remove_dir_all, File};
use std::path::Path;
use tar::{Archive, Builder};
Expand All @@ -19,7 +19,8 @@ pub fn release_tar(source: &String, into: &String) -> Result<()> {
}

pub fn pack_tar(source: &String, store_at: &String) -> Result<()> {
let file = File::create(store_at)?;
let file = File::create(store_at)
.map_err(|e| anyhow!("Error:Failed to create file at '{store_at}' : {e}"))?;
let mut archive = Builder::new(file);
archive.append_dir_all(".", source)?;
archive.finish()?;
Expand Down
5 changes: 3 additions & 2 deletions src/entrances/update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -324,15 +324,16 @@ fn test_update_all() {
// 生成新包
crate::utils::fs::copy_dir("examples/VSCode", "test/VSCode").unwrap();
crate::utils::test::_modify_installed_package_version("test/VSCode", "1.75.4.2");
std::fs::create_dir("test/static").unwrap();
crate::pack(
&"./test/VSCode".to_string(),
Some("./test/VSCode_1.75.4.2_Cno.nep".to_string()),
Some("./test/static/VSCode_1.75.4.2_Cno.nep".to_string()),
false,
)
.unwrap();
crate::pack(
&"./examples/Notepad".to_string(),
Some("./test/Notepad_22.1.0.0_Cno.nep".to_string()),
Some("./test/static/Notepad_22.1.0.0_Cno.nep".to_string()),
false,
)
.unwrap();
Expand Down

0 comments on commit d6e7879

Please sign in to comment.