[−][src]Struct quickcfg::FileSystem
Helper and tracker of any filesystem modifications.
Methods
impl<'a> FileSystem<'a>
[src]
pub fn new(
opts: &'a Opts,
state_dir: &Path,
allocator: &'a UnitAllocator,
data: &'a Data
) -> FileSystem<'a>
[src]
opts: &'a Opts,
state_dir: &Path,
allocator: &'a UnitAllocator,
data: &'a Data
) -> FileSystem<'a>
Create new, thread-safe file utilities.
pub fn validate(self) -> Result<(), Error>
[src]
Validate that we haven't created any conflicting files. Logs details and errors in case duplicates are registered.
pub fn file_dependency(&self, path: &Path) -> Result<Dependency, Error>
[src]
Access or allocate a file dependency of the given path.
pub fn dir_dependency(&self, path: &Path) -> Result<Dependency, Error>
[src]
Access or allocate a directory dependency of the given path.
pub fn symlink(
&self,
path: &Path,
link: PathBuf,
meta: Option<&Metadata>
) -> Result<Option<SystemUnit>, Error>
[src]
&self,
path: &Path,
link: PathBuf,
meta: Option<&Metadata>
) -> Result<Option<SystemUnit>, Error>
Try to create a symlink.
pub fn copy_file(
&self,
from: &Path,
from_meta: Metadata,
to: &Path,
to_meta: Option<&Metadata>,
template: bool
) -> Result<Option<SystemUnit>, Error>
[src]
&self,
from: &Path,
from_meta: Metadata,
to: &Path,
to_meta: Option<&Metadata>,
template: bool
) -> Result<Option<SystemUnit>, Error>
Optionally set up if we should copy a file.
This is true if:
- The destination file does not exist.
- The destination file has a modified timestamp less than the source file.
pub fn create_dir_all(&self, dir: &Path) -> Result<Vec<SystemUnit>, Error>
[src]
Recursively set up units with dependencies to create the given directories.
pub fn state_path(&self, id: &str) -> PathBuf
[src]
Get the state path for the given ID.
pub fn try_open_meta(p: &Path) -> Result<Option<Metadata>, Error>
[src]
Try to open metadata, unless the file does not exist.
If the file does not exist, returns None
.
pub fn should_create_dir(
path: &Path,
meta: Option<&Metadata>
) -> Result<bool, Error>
[src]
path: &Path,
meta: Option<&Metadata>
) -> Result<bool, Error>
Test if we should create the destination directory.
pub fn path_relative_from(path: &Path, base: &Path) -> Option<PathBuf>
[src]
Construct a relative path from a provided base directory path to the provided path
use quickcfg::FileSystem; use std::path::PathBuf; let baz: PathBuf = "/foo/bar/baz".into(); let bar: PathBuf = "/foo/bar".into(); let quux: PathBuf = "/foo/bar/quux".into(); assert_eq!(FileSystem::path_relative_from(&bar, &baz), Some("../".into())); assert_eq!(FileSystem::path_relative_from(&baz, &bar), Some("baz".into())); assert_eq!(FileSystem::path_relative_from(&quux, &baz), Some("../quux".into())); assert_eq!(FileSystem::path_relative_from(&baz, &quux), Some("../baz".into())); assert_eq!(FileSystem::path_relative_from(&bar, &quux), Some("../".into()));
pub fn touch(path: &Path, timestamp: &SystemTime) -> Result<(), Error>
[src]
Update timestamps for the given path.
Auto Trait Implementations
impl<'a> RefUnwindSafe for FileSystem<'a>
impl<'a> Send for FileSystem<'a>
impl<'a> Sync for FileSystem<'a>
impl<'a> Unpin for FileSystem<'a>
impl<'a> UnwindSafe for FileSystem<'a>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,