pub struct DeveloperDirectory { /* private fields */ }
Expand description
A directory containing Apple platforms, SDKs, and other tools.
Implementations§
Source§impl DeveloperDirectory
impl DeveloperDirectory
Sourcepub fn from_env() -> Result<Option<Self>, Error>
pub fn from_env() -> Result<Option<Self>, Error>
Resolve an instance from the DEVELOPER_DIR
environment variable.
This environment variable is used by convention to override default search locations for the developer directory.
If DEVELOPER_DIR
is defined, the value/path is validated for existence
and an error is returned if it doesn’t exist.
If DEVELOPER_DIR
isn’t defined, returns Ok(None)
.
Sourcepub fn from_xcode_select_paths() -> Result<Option<Self>, Error>
pub fn from_xcode_select_paths() -> Result<Option<Self>, Error>
Attempt to resolve an instance by checking the paths that
xcode-select --switch
configures. If there is no path configured,
this returns None
.
This checks, in order:
- The path pointed to by
/var/db/xcode_select_link
. - The path pointed to by
/usr/share/xcode-select/xcode_dir_link
(legacy, previously created byxcode-select
). - The path stored in
/usr/share/xcode-select/xcode_dir_path
(legacy, previously created byxcode-select
).
There are no sources available for xcode-select
, so we do not know
if these are the only paths that xcode-select
uses. We can be fairly
sure, though, since the logic has been reverse-engineered
several times.
The exact list of paths that apple-sdk
searches here is an
implementation detail, and may change in the future (e.g. if
xcode-select
is changed to use a different set of paths).
Sourcepub fn from_xcode_select() -> Result<Self, Error>
pub fn from_xcode_select() -> Result<Self, Error>
Attempt to resolve an instance by running xcode-select
.
The output from xcode-select
is implicitly trusted and no validation
of the path is performed.
Sourcepub fn default_xcode() -> Option<Self>
pub fn default_xcode() -> Option<Self>
Attempt to resolve an instance from the default Xcode.app location.
This looks for a system installed Xcode.app
and for the developer
directory within. If found, returns Some
. If not, returns None
.
Sourcepub fn find_system_xcodes() -> Result<Vec<Self>, Error>
pub fn find_system_xcodes() -> Result<Vec<Self>, Error>
Finds all Developer
directories for system installed Xcode applications.
This is a convenience method for find_system_xcode_applications() plus
resolving the Developer
directory and filtering on missing items.
It will return all available Developer
directories for all Xcode installs
under /Applications
.
Sourcepub fn find_default() -> Result<Option<Self>, Error>
pub fn find_default() -> Result<Option<Self>, Error>
Attempt to find a Developer Directory using reasonable semantics.
This is probably what most end-users want to use for resolving the path to a Developer Directory.
This is a convenience function for calling other APIs on this type to resolve the default instance.
In priority order:
DEVELOPER_DIR
- System Xcode.app application.
xcode-select
output.
Errors only if DEVELOPER_DIR
is defined and it points to an invalid path.
Errors from running xcode-select
are ignored.
Sourcepub fn find_default_required() -> Result<Self, Error>
pub fn find_default_required() -> Result<Self, Error>
Find the Developer Directory and error if not found.
This is a wrapper around Self::find_default() that will error if no Developer Directory could be found.
Sourcepub fn platforms_path(&self) -> PathBuf
pub fn platforms_path(&self) -> PathBuf
The path to the directory containing platforms.
Sourcepub fn platforms(&self) -> Result<Vec<PlatformDirectory>, Error>
pub fn platforms(&self) -> Result<Vec<PlatformDirectory>, Error>
Find platform directories within this developer directory.
Platforms are defined by the presence of a Platforms
directory under
the developer directory. This directory layout is only recognized
for modern Xcode layouts.
Returns all discovered instances inside this developer directory.
The return order is sorted and deterministic.
Sourcepub fn sdks<SDK: AppleSdk>(&self) -> Result<Vec<SDK>, Error>
pub fn sdks<SDK: AppleSdk>(&self) -> Result<Vec<SDK>, Error>
Find SDKs within this developer directory.
This is a convenience method for calling Self::platforms() + PlatformDirectory::find_sdks() and chaining the results.
Trait Implementations§
Source§impl AsRef<Path> for DeveloperDirectory
impl AsRef<Path> for DeveloperDirectory
Source§impl Clone for DeveloperDirectory
impl Clone for DeveloperDirectory
Source§fn clone(&self) -> DeveloperDirectory
fn clone(&self) -> DeveloperDirectory
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for DeveloperDirectory
impl Debug for DeveloperDirectory
Source§impl From<&Path> for DeveloperDirectory
impl From<&Path> for DeveloperDirectory
Source§impl From<&PathBuf> for DeveloperDirectory
impl From<&PathBuf> for DeveloperDirectory
Source§impl From<PathBuf> for DeveloperDirectory
impl From<PathBuf> for DeveloperDirectory
Source§impl PartialEq for DeveloperDirectory
impl PartialEq for DeveloperDirectory
impl Eq for DeveloperDirectory
impl StructuralPartialEq for DeveloperDirectory
Auto Trait Implementations§
impl Freeze for DeveloperDirectory
impl RefUnwindSafe for DeveloperDirectory
impl Send for DeveloperDirectory
impl Sync for DeveloperDirectory
impl Unpin for DeveloperDirectory
impl UnwindSafe for DeveloperDirectory
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§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.