mirror of
https://github.com/132nd-vWing/tacview-splitter.git
synced 2026-08-26 07:48:37 +02:00
refactor create_writer
This commit is contained in:
+5
-5
@@ -12,14 +12,14 @@ pub fn create_writer(
|
|||||||
coalition: &Coalition,
|
coalition: &Coalition,
|
||||||
) -> Result<Box<dyn Write>, Box<dyn ErrTrait>> {
|
) -> Result<Box<dyn Write>, Box<dyn ErrTrait>> {
|
||||||
let base_name = remove_extension(filename, is_zip);
|
let base_name = remove_extension(filename, is_zip);
|
||||||
|
let txt_name = format!("{base_name}_{coalition}{EXTENSION_TXT}");
|
||||||
|
|
||||||
println!("writing {coalition}");
|
println!("writing {coalition}");
|
||||||
if is_zip {
|
if is_zip {
|
||||||
Ok(Box::new(create_zipwriter(
|
let zip_name = format!("{base_name}_{coalition}{EXTENSION_ZIP}");
|
||||||
&format!("{base_name}_{coalition}{EXTENSION_ZIP}"),
|
Ok(Box::new(create_zipwriter(&zip_name, &txt_name)?))
|
||||||
&format!("{base_name}_{coalition}{EXTENSION_TXT}"),
|
|
||||||
)?))
|
|
||||||
} else {
|
} else {
|
||||||
Ok(Box::new(create_textwriter(base_name)?))
|
Ok(Box::new(create_textwriter(&txt_name)?))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user