pub struct PathResolutionContext { /* private fields */ }Expand description
Runtime paths needed to resolve platform-independent policy selectors.
The context is supplied by a harness or a platform backend. Constructing it never reads the filesystem, follows symlinks, or infers a workspace.
Implementations§
Source§impl PathResolutionContext
impl PathResolutionContext
Sourcepub fn with_root(self, path: impl Into<PathBuf>) -> Result<Self, PolicyError>
pub fn with_root(self, path: impl Into<PathBuf>) -> Result<Self, PolicyError>
Adds one absolute system root represented by the runtime environment.
POSIX backends normally provide /. Windows backends may provide more
than one drive or UNC root. The context never discovers these paths on
its own.
Sourcepub fn with_workspace_root(
self,
path: impl Into<PathBuf>,
) -> Result<Self, PolicyError>
pub fn with_workspace_root( self, path: impl Into<PathBuf>, ) -> Result<Self, PolicyError>
Adds one absolute workspace root.
Sourcepub fn with_minimal_path(
self,
path: impl Into<PathBuf>,
) -> Result<Self, PolicyError>
pub fn with_minimal_path( self, path: impl Into<PathBuf>, ) -> Result<Self, PolicyError>
Adds one absolute path required by ordinary process execution.
Sourcepub fn with_executable_root(
self,
path: impl Into<PathBuf>,
) -> Result<Self, PolicyError>
pub fn with_executable_root( self, path: impl Into<PathBuf>, ) -> Result<Self, PolicyError>
Adds one absolute runtime root whose executable files may be mapped by a backend that supports this capability.
This declaration is intentionally separate from readable filesystem roots. Reading a runtime file does not by itself authorize the native loader to map it executable.
Sourcepub fn with_tmpdir(self, path: impl Into<PathBuf>) -> Result<Self, PolicyError>
pub fn with_tmpdir(self, path: impl Into<PathBuf>) -> Result<Self, PolicyError>
Sets the platform temporary directory.
Sourcepub fn with_slash_tmp(
self,
path: impl Into<PathBuf>,
) -> Result<Self, PolicyError>
pub fn with_slash_tmp( self, path: impl Into<PathBuf>, ) -> Result<Self, PolicyError>
Sets the conventional /tmp directory when the platform provides it.
Sourcepub fn with_current_directory(
self,
path: impl Into<PathBuf>,
) -> Result<Self, PolicyError>
pub fn with_current_directory( self, path: impl Into<PathBuf>, ) -> Result<Self, PolicyError>
Sets the absolute runtime current directory used for command cwd resolution and for commands that otherwise inherit their cwd.
This is runtime input only; the context never reads the directory or changes the process cwd.
Sourcepub fn workspace_roots(&self) -> &[PathBuf]
pub fn workspace_roots(&self) -> &[PathBuf]
Returns the configured workspace roots.
Sourcepub fn root_paths(&self) -> &[PathBuf]
pub fn root_paths(&self) -> &[PathBuf]
Returns the absolute system roots supplied by the runtime.
Sourcepub fn minimal_paths(&self) -> &[PathBuf]
pub fn minimal_paths(&self) -> &[PathBuf]
Returns the configured minimal runtime paths.
Sourcepub fn executable_roots(&self) -> &[PathBuf]
pub fn executable_roots(&self) -> &[PathBuf]
Returns runtime roots declared for native executable mapping.
Sourcepub fn current_directory(&self) -> Option<&Path>
pub fn current_directory(&self) -> Option<&Path>
Returns the absolute runtime directory used for relative command cwd values and for commands that inherit their cwd.