use rightkit_daemon::{CallContext, HostExpectation, HostIdentityReason};
use std::path::PathBuf;
const NO_SUCH_EXECUTABLE: &str = "\0rightkit-peer-executable-probe";
pub trait CallContextExt {
fn peer_executable(&self) -> Option<PathBuf>;
}
impl CallContextExt for CallContext {
fn peer_executable(&self) -> Option<PathBuf> {
let probe = HostExpectation::executable(NO_SUCH_EXECUTABLE);
match self.verify_peer_executable(&probe) {
Ok(host) => Some(host.executable),
Err(e) if e.reason == HostIdentityReason::ExecutableMismatch => e.found_executable,
Err(_) => None,
}
}
}