Enumeration of the filesystem paths for the various standard system directories where apps, resources, etc. get installed.
This crate exposes Rust bindings to the sysdir(3)
library functions provided
by libSystem.dylib
on macOS, iOS, tvOS, and watchOS.
The sysdir
API first appeared in OS X 10.12, iOS 10, watchOS 3 and tvOS 10
replacing the deprecated NSSystemDirectories(3)
API.
Add this to your Cargo.toml
:
toml
[dependencies]
sysdir = "1.0.0"
Then resolve well-known directories like this:
```rust use core::ffi::{c_char, CStr};
use sysdir::*;
let mut path = [0; PATH_MAX as usize];
let dir = sysdirsearchpathdirectoryt::SYSDIRDIRECTORYUSER; let domainmask = SYSDIRDOMAINMASKLOCAL;
unsafe {
let mut state = sysdirstartsearchpathenumeration(dir, domainmask);
loop {
let path = path.asmutptr().cast::
sysdir-rs binds directly to libSystem
with vendored bindings generated by
bindgen
. This crate has no dependencies other than
libSystem
.
no_std
sysdir-rs is no_std
and only requires core
.
This crate requires at least Rust 1.64.0. This version can be bumped in minor releases.
sysdir-rs
is distributed under the terms of either the
MIT License or the
Apache License (Version 2.0).