JFLib

plat/apple_sys.rs (Apple)#

Source: lib/plat/apple_sys.rs

apple_sys -- files, directories and well-known paths on macOS and iOS (libSystem; the same
functions as linux_sys.rs, whose comments say what each one promises)

No static buffers: every function may run on any thread.  OsFile::read_at / write_at are pread /
pwrite, so several threads may use one file at the same time.  sync is F_FULLFSYNC: on Apple a
plain fsync leaves the data in the drive's cache.
  • fn dev_ino(path: &str) -> Option<(u64, u64)> (st_dev, st_ino) of a path (links followed), None when it cannot be read [fd_visit_once]

  • fn config_dir() -> Option<String> ~/Library/Application Support (on iOS inside the app's container, whose root is $HOME). The same folder as data_dir, as Rust's dirs crate has it: config:// and data:// share the app's folder.

  • fn data_dir() -> Option<String> ~/Library/Application Support

  • fn cache_dir() -> Option<String> ~/Library/Caches

  • fn temp_dir() -> Option<String> $TMPDIR (absolute; macOS gives each user one, iOS each app), else /tmp

  • fn cwd() -> String the current directory ("" on failure) [plat_cwd]

Source: docs/API.md in the JFLib repository.