1
0
mirror of https://github.com/jht5945/buildj.git synced 2025-12-28 17:50:05 +08:00

style: use rust_util s macros

This commit is contained in:
2020-08-02 12:08:07 +08:00
parent ddf1c54d5d
commit de23b593fe
3 changed files with 19 additions and 34 deletions

View File

@@ -10,7 +10,6 @@ use std::{
use rust_util::{
XResult,
new_box_ioerror,
util_msg::print_error,
util_io::*,
};
@@ -51,7 +50,7 @@ pub fn verify_file_integrity(integrity: &str, file_name: &str) -> XResult<bool>
};
let integrity_verify_result = digest_hex == calc_digest_hex.as_str();
if ! integrity_verify_result {
print_error(&format!("Verify integrity failed, expected: {}, actual: {}", digest_hex, calc_digest_hex));
failure!("Verify integrity failed, expected: {}, actual: {}", digest_hex, calc_digest_hex);
}
Ok(integrity_verify_result)
},
@@ -131,7 +130,7 @@ pub fn init_home_dir(home_sub_dir: &str) {
pub fn init_dir(dir: &str) {
if ! Path::new(dir).exists() {
fs::create_dir_all(dir).unwrap_or_else(|err| {
print_error(&format!("Init dir {} failed: {}", dir, err));
failure!("Init dir {} failed: {}", dir, err);
});
}
}