mirror of
https://github.com/tauri-apps/tauri.git
synced 2024-12-19 00:21:32 +03:00
feat(core): expose scope::fs::Scope::new (#8432)
This commit is contained in:
parent
11a1529d6a
commit
b59f2f54e7
5
.changes/expose-fs-scope-new.md
Normal file
5
.changes/expose-fs-scope-new.md
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
"tauri": patch:feat
|
||||
---
|
||||
|
||||
Expose `scope::fs::Scope::new`.
|
@ -1568,7 +1568,7 @@ impl<R: Runtime> Builder<R> {
|
||||
app.manage(Scopes {
|
||||
ipc: scope::ipc::Scope::new(app.config()),
|
||||
#[cfg(feature = "protocol-asset")]
|
||||
asset_protocol: scope::fs::Scope::for_fs_api(
|
||||
asset_protocol: scope::fs::Scope::new(
|
||||
&app,
|
||||
&app.config().tauri.security.asset_protocol.scope,
|
||||
)?,
|
||||
|
@ -91,11 +91,10 @@ fn push_pattern<P: AsRef<Path>, F: Fn(&str) -> Result<Pattern, glob::PatternErro
|
||||
}
|
||||
|
||||
impl Scope {
|
||||
/// Creates a new scope from a `FsAllowlistScope` configuration.
|
||||
#[allow(unused)]
|
||||
pub(crate) fn for_fs_api<R: crate::Runtime, M: crate::Manager<R>>(
|
||||
/// Creates a new scope from a [`FsScope`] configuration.
|
||||
pub fn new<R: crate::Runtime, M: crate::Manager<R>>(
|
||||
manager: &M,
|
||||
scope: &tauri_utils::config::FsScope,
|
||||
scope: &FsScope,
|
||||
) -> crate::Result<Self> {
|
||||
let mut allowed_patterns = HashSet::new();
|
||||
for path in scope.allowed_paths() {
|
||||
|
Loading…
Reference in New Issue
Block a user