Function apple_codesign::path_is_xar
source · pub fn path_is_xar(path: impl AsRef<Path>) -> Result<bool, AppleCodesignError>
Expand description
Test whether a given path is likely a XAR file.
Examples found in repository?
src/reader.rs (line 111)
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126
pub fn from_path(path: impl AsRef<Path>) -> Result<Self, AppleCodesignError> {
let path = path.as_ref();
if path.is_file() {
if path_is_dmg(path)? {
Ok(PathType::Dmg)
} else if path_is_xar(path)? {
Ok(PathType::Xar)
} else if path_is_zip(path)? {
Ok(PathType::Zip)
} else {
match MachOType::from_path(path)? {
Some(MachOType::Mach | MachOType::MachO) => Ok(Self::MachO),
None => Ok(Self::Other),
}
}
} else if path.is_dir() {
Ok(PathType::Bundle)
} else {
Ok(PathType::Other)
}
}