pub struct FileSystemManager { /* private fields */ }Implementations§
Source§impl FileSystemManager
impl FileSystemManager
pub fn new() -> Self
Sourcepub async fn create_dir(
&self,
path: impl AsRef<Path>,
create_components: bool,
) -> Result<()>
pub async fn create_dir( &self, path: impl AsRef<Path>, create_components: bool, ) -> Result<()>
Creates a new directory
Sourcepub async fn rename_dir(
&mut self,
from: impl AsRef<Path>,
to: impl AsRef<Path>,
) -> Result<()>
pub async fn rename_dir( &mut self, from: impl AsRef<Path>, to: impl AsRef<Path>, ) -> Result<()>
Attempts to rename an entire directory.
Will fail if there is an open file within the directory on any level.
Sourcepub async fn remove_dir(
&mut self,
path: impl AsRef<Path>,
non_empty: bool,
) -> Result<()>
pub async fn remove_dir( &mut self, path: impl AsRef<Path>, non_empty: bool, ) -> Result<()>
Attempts to remove an entire directory, failing if any file is currently open within the directory.
Sourcepub async fn dir_entries(
&self,
path: impl AsRef<Path>,
) -> Result<Vec<LocalDirEntry>>
pub async fn dir_entries( &self, path: impl AsRef<Path>, ) -> Result<Vec<LocalDirEntry>>
Retrieves all entries within the directory path.
This is a non-recursive operation, meaning that it will only yield the immediate directory entires and not walk through subdirectories or follow symlinks.
Will yield an error if there are complications with reading the directory and its entries.
Sourcepub async fn open_file(
&mut self,
path: impl AsRef<Path>,
create: bool,
write: bool,
read: bool,
) -> Result<LocalFileHandle>
pub async fn open_file( &mut self, path: impl AsRef<Path>, create: bool, write: bool, read: bool, ) -> Result<LocalFileHandle>
Opens a file, creating it if create true, using write and read
for permissions.
If the file is already open, will return the existing instance. If permissions differ where the returned file does not have read/write access and the request asks for it, the current instance of the file will be closed and a new instance with the same id will be opened with the new permissions where existing and requested permissions align.
Sourcepub fn close_file(&mut self, handle: LocalFileHandle) -> Result<LocalFile>
pub fn close_file(&mut self, handle: LocalFileHandle) -> Result<LocalFile>
Closes an open file by handle.
Will fail if no file with handle id is open, or if the signature
on the file is different than that of handle.
Sourcepub async fn rename_file(
&mut self,
from: impl AsRef<Path>,
to: impl AsRef<Path>,
) -> Result<()>
pub async fn rename_file( &mut self, from: impl AsRef<Path>, to: impl AsRef<Path>, ) -> Result<()>
Attempts to rename a file at from into to.
Will fail if file is open at from.
Sourcepub async fn remove_file(&mut self, path: impl AsRef<Path>) -> Result<()>
pub async fn remove_file(&mut self, path: impl AsRef<Path>) -> Result<()>
Attempts to remove a file, failing if the file is currently open.
Sourcepub fn get_mut(&mut self, id: impl Into<u32>) -> Option<&mut LocalFile>
pub fn get_mut(&mut self, id: impl Into<u32>) -> Option<&mut LocalFile>
Looks up an open file by its associated id