add helper method to AppContext to simplify getting options

This commit is contained in:
theubusu
2026-02-22 20:14:04 +01:00
parent 3989710c70
commit a6567ae532
9 changed files with 16 additions and 21 deletions
+1 -2
View File
@@ -44,7 +44,6 @@ pub fn is_mtk_pkg_file(app_ctx: &AppContext) -> Result<Option<Box<dyn Any>>, Box
pub fn extract_mtk_pkg(app_ctx: &AppContext, ctx: Box<dyn Any>) -> Result<(), Box<dyn std::error::Error>> {
let mut file = app_ctx.file().ok_or("Extractor expected file")?;
let ctx = ctx.downcast::<MtkPkgContext>().expect("Missing context");
let no_del_comp = app_ctx.options.iter().any(|e| e == "mtk_pkg:no_del_comp");
let file_size = file.metadata()?.len();
let header = ctx.decrypted_header;
@@ -153,7 +152,7 @@ pub fn extract_mtk_pkg(app_ctx: &AppContext, ctx: Box<dyn Any>) -> Result<(), Bo
match decompress_lzhs_fs_file2file(&out_file, lzhs_out_path) {
Ok(()) => {
println!("- Decompressed Successfully!");
if !no_del_comp {
if !app_ctx.has_option("mtk_pkg:no_del_comp") {
//after successfull decompression remove the temporary .lzhs file
fs::remove_file(&output_path)?;
}