Trait symbolic_common::DSymPathExt
source · pub trait DSymPathExt {
// Required methods
fn is_dsym_dir(&self) -> bool;
fn resolve_dsym(&self) -> Option<PathBuf>;
fn dsym_parent(&self) -> Option<&Path>;
}Expand description
Extensions to Path for handling dSYM directories.
dSYM Files
dSYM files are actually folder structures that store debugging information on Apple platforms.
They are also referred to as debug companion. At the core of this structure is a MachO file
containing the actual debug information.
A full dSYM folder structure looks like this:
MyApp.dSYM
└── Contents
├── Info.plist
└── Resources
└── DWARF
└── MyApp
Required Methods§
sourcefn is_dsym_dir(&self) -> bool
fn is_dsym_dir(&self) -> bool
Returns true if this path points to an existing directory with a .dSYM extension.
Note that this does not check if a full dSYM structure is contained within this folder.
Examples
use std::path::Path;
use symbolic_common::DSymPathExt;
assert!(Path::new("Foo.dSYM").is_dsym_dir());
assert!(!Path::new("Foo").is_dsym_dir());sourcefn resolve_dsym(&self) -> Option<PathBuf>
fn resolve_dsym(&self) -> Option<PathBuf>
Resolves the path of the debug file in a dSYM directory structure.
Returns Some(path) if this path is a dSYM directory according to is_dsym_dir, and a
file of the same name is located at Contents/Resources/DWARF/.
Examples
use std::path::Path;
use symbolic_common::DSymPathExt;
let path = Path::new("Foo.dSYM");
let dsym_path = path.resolve_dsym().unwrap();
assert_eq!(dsym_path, Path::new("Foo.dSYM/Contents/Resources/DWARF/Foo"));sourcefn dsym_parent(&self) -> Option<&Path>
fn dsym_parent(&self) -> Option<&Path>
Resolves the dSYM parent directory if this file is a dSYM.
If this path points to the MachO file in a dSYM directory structure, this function returns
the path to the dSYM directory. Returns None if the parent does not exist or the file name
does not match.
Examples
use std::path::Path;
use symbolic_common::DSymPathExt;
let path = Path::new("Foo.dSYM/Contents/Resources/DWARF/Foo");
let parent = path.dsym_parent().unwrap();
assert_eq!(parent, Path::new("Foo.dSYM"));
let path = Path::new("Foo.dSYM/Contents/Resources/DWARF/Bar");
assert_eq!(path.dsym_parent(), None);