pub struct ZLayerDirs { /* private fields */ }Expand description
Centralized filesystem path resolution for ZLayer.
All ZLayer crates should use this instead of hardcoding paths.
Implementations§
Source§impl ZLayerDirs
impl ZLayerDirs
Sourcepub fn system_default() -> Self
pub fn system_default() -> Self
Create using the platform default data directory.
Sourcepub fn default_data_dir() -> PathBuf
pub fn default_data_dir() -> PathBuf
Platform-aware default data directory.
- macOS:
~/.zlayer - Linux (root):
/var/lib/zlayer - Linux (user):
~/.zlayer - Windows:
%LOCALAPPDATA%\ZLayerorC:\ProgramData\ZLayer
Sourcepub fn detect_data_dir() -> PathBuf
pub fn detect_data_dir() -> PathBuf
Detect the data directory of an existing installation.
On Linux, if not root, checks whether /var/lib/zlayer/daemon.json
exists (indicating a system-level install) and returns
/var/lib/zlayer if so. Otherwise falls back to [default_data_dir].
Sourcepub fn default_run_dir() -> PathBuf
pub fn default_run_dir() -> PathBuf
Default runtime directory.
- Linux:
/var/run/zlayer - macOS:
{default_data_dir}/run - Windows:
{default_data_dir}\run
Sourcepub fn default_log_dir() -> PathBuf
pub fn default_log_dir() -> PathBuf
Default log directory.
- Linux:
/var/log/zlayer - macOS:
{default_data_dir}/logs - Windows:
{default_data_dir}\logs
Sourcepub fn default_socket_path() -> String
pub fn default_socket_path() -> String
Default Unix socket path.
- Linux:
/var/run/zlayer.sock - macOS:
{default_data_dir}/run/zlayer.sock - Windows:
tcp://127.0.0.1:3669
Sourcepub fn default_binary_dir() -> PathBuf
pub fn default_binary_dir() -> PathBuf
Preferred system directory for the zlayer binary.
Tries /usr/local/bin first (standard FHS, writable on most systems).
Falls back to {data_dir}/bin (/var/lib/zlayer/bin on Linux as root)
which is always writable since ZLayer owns that directory.
On macOS and Windows, returns /usr/local/bin or the data-dir bin
subdirectory respectively.
Sourcepub fn containers(&self) -> PathBuf
pub fn containers(&self) -> PathBuf
Container state directory ({data}/containers).
Sourcepub fn wasm_compiled(&self) -> PathBuf
pub fn wasm_compiled(&self) -> PathBuf
AOT-compiled WASM cache directory ({data}/wasm/compiled).
Sourcepub fn admin_password(&self) -> PathBuf
pub fn admin_password(&self) -> PathBuf
Admin password file path ({data}/admin_password).
Sourcepub fn daemon_json(&self) -> PathBuf
pub fn daemon_json(&self) -> PathBuf
Daemon metadata file path ({data}/daemon.json).
Sourcepub fn logs(&self) -> PathBuf
pub fn logs(&self) -> PathBuf
Logs subdirectory under data_dir ({data}/logs).
Used on macOS where logs live under the user data dir.
Sourcepub fn toolchain_cache(&self) -> PathBuf
pub fn toolchain_cache(&self) -> PathBuf
Toolchain download cache directory ({data}/toolchain-cache).