android_tools_rs/aapt2/
daemon.rs1use crate::error::*;
2use std::{
3 path::{Path, PathBuf},
4 process::Command,
5};
6
7pub struct Aapt2Daemon {
8 trace_folder: PathBuf,
9 help: bool,
10}
11
12impl Aapt2Daemon {
13 pub fn new(trace_folder: &Path) -> Self {
15 Self {
16 trace_folder: trace_folder.to_owned(),
17 help: false,
18 }
19 }
20
21 pub fn help(&mut self, help: bool) -> &mut Self {
23 self.help = help;
24 self
25 }
26
27 pub fn run(&self) -> Result<()> {
29 let mut aapt2 = Command::new("aapt2");
30 aapt2.arg("daemon");
31 aapt2.arg(&self.trace_folder);
32 if self.help {
33 aapt2.arg("-h");
34 }
35 aapt2.output_err(true)?;
36 Ok(())
37 }
38}