pub fn validate_plist(
    config_plist: &PathBuf,
    resources: &Resources,
    stdout: &mut Stdout,
) -> Result<bool, Box<dyn Error>> {
    let mut config_okay = true;
    let ocvalidate_bin = resources
        .open_core_binaries_path
        .join("Utilities/ocvalidate")
        .join(match std::env::consts::OS {
            "macos" => "ocvalidate",
            "windows" => "ocvalidate.exe",
            "linux" => "ocvalidate.linux",
            _ => "ocvalidate",
        });
    if ocvalidate_bin.exists() {
        let out = res::status(
            ocvalidate_bin.to_str().unwrap(),
            &[&config_plist.to_str().unwrap()],
        )?;
        terminal::disable_raw_mode()?;

        write!(stdout, "{}\r\n", String::from_utf8(out.stdout).unwrap())?;
        terminal::enable_raw_mode()?;

        if out.status.code().unwrap() != 0 {
            config_okay = false;
            write!(
                stdout,
                "\x1B[31mERROR: Problems(s) found in config.plist!\x1B[0m\r\n"
            )?;
            write!(stdout, "{}\r\n", String::from_utf8(out.stderr).unwrap())?;
        }
    } else {
        write!(
            stdout,
            "\r\n{:?}\r\n\x1b[33mocvalidate utility not found, skipping.\x1b[0m\r\n",
            ocvalidate_bin,
        )?;
    }
    Ok(config_okay)
}
/// run loaded config.plist through the corresponding ocvalidate utility if it
/// exists (no ocvalidate before oc 0.6.0, may be no ocvalidate available depending
/// on what OS is currently being run)
run loaded config.plist through the corresponding ocvalidate utility if it
exists (no ocvalidate before oc 0.6.0, may be no ocvalidate available depending
on what OS is currently being run)
run loaded config . plist through the corresponding ocvalidate utility if it exists ( no ocvalidate before oc 0 . 6 . 0 may be no ocvalidate available depending on what OS is currently being run )
pub fn validate_plist(
    config_plist: &PathBuf,
    resources: &Resources,
    stdout: &mut Stdout,
) -> Result<bool, Box<dyn Error>> {
    let mut config_okay = true;
    let ocvalidate_bin = resources
        .open_core_binaries_path
        .join("Utilities/ocvalidate")
        .join(match std::env::consts::OS {
            "macos" => "ocvalidate",
            "windows" => "ocvalidate.exe",
            "linux" => "ocvalidate.linux",
            _ => "ocvalidate",
        });
    if ocvalidate_bin.exists() {
        let out = res::status(
            ocvalidate_bin.to_str().unwrap(),
            &[&config_plist.to_str().unwrap()],
        )?;
        terminal::disable_raw_mode()?;
        write!(stdout, "{}\r\n", String::from_utf8(out.stdout).unwrap())?;
        terminal::enable_raw_mode()?;
        if out.status.code().unwrap() != 0 {
            config_okay = false;
            write!(
                stdout,
                "\x1B[31mERROR: Problems(s) found in config.plist!\x1B[0m\r\n"
            )?;
            write!(stdout, "{}\r\n", String::from_utf8(out.stderr).unwrap())?;
        }
    } else {
        write!(
            stdout,
            "\r\n{:?}\r\n\x1b[33mocvalidate utility not found, skipping.\x1b[0m\r\n",
            ocvalidate_bin,
        )?;
    }
    Ok(config_okay)
}
pub fn validate_plist ( config_plist : & PathBuf , resources : & Resources , stdout : & mut Stdout , ) -> Result < bool , Box < dyn Error > > { let mut config_okay = true ; let ocvalidate_bin = resources . open_core_binaries_path . join ( " " ) . join ( match std :: env :: consts :: OS { " " => " " , " " => " " , " " => " " , _ => " " , } ) ; if ocvalidate_bin . exists ( ) { let out = res :: status ( ocvalidate_bin . to_str ( ) . unwrap ( ) , & [ & config_plist . to_str ( ) . unwrap ( ) ] , ) ? ; terminal :: disable_raw_mode ( ) ? ; write ! ( stdout " \r \n " String from_utf8 ( out stdout ) unwrap ( ) ) ? ; terminal :: enable_raw_mode ( ) ? ; if out . status . code ( ) . unwrap ( ) != 0 { config_okay = false ; write ! ( stdout " \x1B \x1B \r \n " ) ? ; write ! ( stdout " \r \n " String from_utf8 ( out stderr ) unwrap ( ) ) ? ; } } else { write ! ( stdout " \r \n \r \n \x1b \x1b \r \n " ocvalidate_bin ) ? ; } Ok ( config_okay ) }
run loaded config.plist through the corresponding ocvalidate utility if it
exists (no ocvalidate before oc 0.6.0, may be no ocvalidate available depending
on what OS is currently being run)
run loaded config . plist through the corresponding ocvalidate utility if it exists ( no ocvalidate before oc 0 . 6 . 0 may be no ocvalidate available depending on what OS is currently being run )
config_plist
&PathBuf
resources
&Resources
stdout
&mut Stdout
config_plist
&PathBuf
resources
&Resources
stdout
&mut Stdout