pub struct FsScope { /* private fields */ }
Expand description
Scope for filesystem access.
Implementations§
source§impl Scope
impl Scope
sourcepub fn allowed_patterns(&self) -> HashSet<Pattern>
pub fn allowed_patterns(&self) -> HashSet<Pattern>
The list of allowed patterns.
sourcepub fn forbidden_patterns(&self) -> HashSet<Pattern>
pub fn forbidden_patterns(&self) -> HashSet<Pattern>
The list of forbidden patterns.
sourcepub fn listen<F: Fn(&Event) + Send + 'static>(&self, f: F) -> Uuid
pub fn listen<F: Fn(&Event) + Send + 'static>(&self, f: F) -> Uuid
Listen to an event on this scope.
sourcepub fn allow_directory<P: AsRef<Path>>(
&self,
path: P,
recursive: bool
) -> Result<()>
pub fn allow_directory<P: AsRef<Path>>( &self, path: P, recursive: bool ) -> Result<()>
Extend the allowed patterns with the given directory.
After this function has been called, the frontend will be able to use the Tauri API to read
the directory and all of its files. If recursive
is true
, subdirectories will be accessible too.
sourcepub fn allow_file<P: AsRef<Path>>(&self, path: P) -> Result<()>
pub fn allow_file<P: AsRef<Path>>(&self, path: P) -> Result<()>
Extend the allowed patterns with the given file path.
After this function has been called, the frontend will be able to use the Tauri API to read the contents of this file.
sourcepub fn forbid_directory<P: AsRef<Path>>(
&self,
path: P,
recursive: bool
) -> Result<()>
pub fn forbid_directory<P: AsRef<Path>>( &self, path: P, recursive: bool ) -> Result<()>
Set the given directory path to be forbidden by this scope.
Note: this takes precedence over allowed paths, so its access gets denied always.
sourcepub fn forbid_file<P: AsRef<Path>>(&self, path: P) -> Result<()>
pub fn forbid_file<P: AsRef<Path>>(&self, path: P) -> Result<()>
Set the given file path to be forbidden by this scope.
Note: this takes precedence over allowed paths, so its access gets denied always.
sourcepub fn is_allowed<P: AsRef<Path>>(&self, path: P) -> bool
pub fn is_allowed<P: AsRef<Path>>(&self, path: P) -> bool
Determines if the given path is allowed on this scope.