pub struct Files { /* private fields */ }Expand description
Policy layers, each read from a path.
A layer with no path, or whose path is not there, says nothing.
Implementations§
Source§impl Files
impl Files
Sourcepub fn at(self, origin: Origin, path: impl Into<PathBuf>) -> Self
pub fn at(self, origin: Origin, path: impl Into<PathBuf>) -> Self
Read this layer from this path.
Sourcepub fn locations(&self) -> impl DoubleEndedIterator<Item = (Origin, &Path)>
pub fn locations(&self) -> impl DoubleEndedIterator<Item = (Origin, &Path)>
Where each layer is looked for, highest authority first.
For an interface that reports the file it is actually reading rather
than the one the documentation names. Every path here comes out of the
environment — XDG_CONFIG_HOME on this platform, and the equivalents
elsewhere — so where a person’s settings live and where they live by
default are two questions, and only the running program can answer the
first.
A layer being listed says nothing about the file being there. Ask
Source::layer for that, which reads it.
Sourcepub fn for_this_platform() -> Self
pub fn for_this_platform() -> Self
The layers this platform keeps in files, at the places concept 10 names.
Linux and macOS, and the same two places on both: a root-owned
/etc/slipcase taking precedence over the user’s own configuration
under $XDG_CONFIG_HOME. macOS has /etc and keeps it root-owned the
same way, and the XDG path for the user’s file is the family’s
precedent there — slipcase-desktop keeps its state under the XDG
directories on macOS — which is also what lets tests/the_process.rs
hold both platforms to one answer. Sessions are the exception and
session::platform_base says why.
There is no per-user policy layer on either, because neither has a
mechanism in files that would administer one — Origin::UserPolicy is
Windows vocabulary, and the configuration profile concept 10 names for
macOS is not built. Inventing a file for it would be offering an
administrator a control that nothing enforces.
Windows gets nothing from this and reads its policy from the registry.
The Linux filenames are confirmed against the package that installs
them; on macOS nothing installs them and packaging/macos/README.md
says what an administrator writes by hand.