pub struct DirectoryBundle { /* private fields */ }
Expand description
An Apple bundle backed by a filesystem/directory.
Instances represent a type-agnostic bundle (macOS application bundle, iOS application bundle, framework bundles, etc).
Implementations§
Source§impl DirectoryBundle
impl DirectoryBundle
Sourcepub fn new_from_path(directory: &Path) -> Result<Self>
pub fn new_from_path(directory: &Path) -> Result<Self>
Open an existing bundle from a filesystem path.
The specified path should be the root directory of the bundle.
This will validate that the directory is a bundle and error if not.
Validation is limited to locating an Info.plist
file, which is
required for all bundle types.
Sourcepub fn resolve_path(&self, path: impl AsRef<Path>) -> PathBuf
pub fn resolve_path(&self, path: impl AsRef<Path>) -> PathBuf
Resolve the absolute path to a file in the bundle.
Sourcepub fn name(&self) -> &str
pub fn name(&self) -> &str
The on-disk name of this bundle.
This is effectively the directory name of the bundle. Contains the .app
,
.framework
, etc suffix.
Sourcepub fn shallow(&self) -> bool
pub fn shallow(&self) -> bool
Whether this is a shallow bundle.
If false, content is likely in a Contents
directory.
Sourcepub fn info_plist_path(&self) -> PathBuf
pub fn info_plist_path(&self) -> PathBuf
Obtain the path to the Info.plist
file.
Sourcepub fn info_plist(&self) -> &Dictionary
pub fn info_plist(&self) -> &Dictionary
Obtain the parsed Info.plist
file.
Sourcepub fn info_plist_key_string(&self, key: &str) -> Result<Option<String>>
pub fn info_plist_key_string(&self, key: &str) -> Result<Option<String>>
Obtain an Info.plist
key as a String
.
Will return None
if the specified key doesn’t exist. Errors if the key value
is not a string.
Sourcepub fn package_type(&self) -> BundlePackageType
pub fn package_type(&self) -> BundlePackageType
Obtain the type of bundle.
Sourcepub fn display_name(&self) -> Result<Option<String>>
pub fn display_name(&self) -> Result<Option<String>>
Obtain the bundle display name.
This retrieves the value of CFBundleDisplayName
from the Info.plist
.
Sourcepub fn identifier(&self) -> Result<Option<String>>
pub fn identifier(&self) -> Result<Option<String>>
Obtain the bundle identifier.
This retrieves CFBundleIdentifier
from the Info.plist
.
Sourcepub fn version(&self) -> Result<Option<String>>
pub fn version(&self) -> Result<Option<String>>
Obtain the bundle version string.
This retrieves CFBundleVersion
from the Info.plist
.
Sourcepub fn main_executable(&self) -> Result<Option<String>>
pub fn main_executable(&self) -> Result<Option<String>>
Obtain the name of the bundle’s main executable file.
This retrieves CFBundleExecutable
from the Info.plist
.
Sourcepub fn icon_files(&self) -> Result<Option<Vec<String>>>
pub fn icon_files(&self) -> Result<Option<Vec<String>>>
Obtain filenames of bundle icon files.
This retrieves CFBundleIconFiles
from the Info.plist
.
Sourcepub fn files(
&self,
traverse_nested: bool,
) -> Result<Vec<DirectoryBundleFile<'_>>>
pub fn files( &self, traverse_nested: bool, ) -> Result<Vec<DirectoryBundleFile<'_>>>
Obtain all files within this bundle.
The iteration order is deterministic.
traverse_nested
defines whether to traverse into nested bundles.
Sourcepub fn files_manifest(&self, traverse_nested: bool) -> Result<FileManifest>
pub fn files_manifest(&self, traverse_nested: bool) -> Result<FileManifest>
Obtain all files in this bundle as a FileManifest.
Sourcepub fn nested_bundles(&self, descend: bool) -> Result<Vec<(String, Self)>>
pub fn nested_bundles(&self, descend: bool) -> Result<Vec<(String, Self)>>
Obtain all nested bundles within this one.
This walks the directory tree for directories that can be parsed as bundles.
If descend
is true, we will descend into nested bundles and recursively emit nested
bundles. Otherwise we stop traversal once a bundle is encountered.
Sourcepub fn framework_versions(&self) -> Result<Vec<String>>
pub fn framework_versions(&self) -> Result<Vec<String>>
Resolve the versions present within a framework.
Does not emit versions that are symlinks.
Sourcepub fn is_framework_version(&self) -> bool
pub fn is_framework_version(&self) -> bool
Whether this bundle is a version within a framework bundle.
This is true if we are a framework bundle under a Versions
directory.
Trait Implementations§
Source§impl Clone for DirectoryBundle
impl Clone for DirectoryBundle
Source§fn clone(&self) -> DirectoryBundle
fn clone(&self) -> DirectoryBundle
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreAuto Trait Implementations§
impl Freeze for DirectoryBundle
impl RefUnwindSafe for DirectoryBundle
impl Send for DirectoryBundle
impl Sync for DirectoryBundle
impl Unpin for DirectoryBundle
impl UnwindSafe for DirectoryBundle
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)