mirror of
https://github.com/tauri-apps/plugins-workspace.git
synced 2026-04-21 11:26:15 +02:00
fix(fs): Prevent deadlock when scope listeners are registered. (#1221)
* fix(fs): Prevent deadlock when scope listeners are registered. * block
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"fs": patch
|
||||
---
|
||||
|
||||
Fixes an issue that caused the app to freeze when the `dialog`, `fs`, and `persisted-scope` plugins were used together.
|
||||
+10
-6
@@ -55,9 +55,11 @@ impl Scope {
|
||||
pub fn allow_directory<P: AsRef<Path>>(&self, path: P, recursive: bool) {
|
||||
let path = path.as_ref();
|
||||
|
||||
let mut allowed = self.allowed.lock().unwrap();
|
||||
allowed.push(path.to_path_buf());
|
||||
allowed.push(path.join(if recursive { "**" } else { "*" }));
|
||||
{
|
||||
let mut allowed = self.allowed.lock().unwrap();
|
||||
allowed.push(path.to_path_buf());
|
||||
allowed.push(path.join(if recursive { "**" } else { "*" }));
|
||||
}
|
||||
|
||||
self.emit(Event::PathAllowed(path.to_path_buf()));
|
||||
}
|
||||
@@ -79,9 +81,11 @@ impl Scope {
|
||||
pub fn forbid_directory<P: AsRef<Path>>(&self, path: P, recursive: bool) {
|
||||
let path = path.as_ref();
|
||||
|
||||
let mut denied = self.denied.lock().unwrap();
|
||||
denied.push(path.to_path_buf());
|
||||
denied.push(path.join(if recursive { "**" } else { "*" }));
|
||||
{
|
||||
let mut denied = self.denied.lock().unwrap();
|
||||
denied.push(path.to_path_buf());
|
||||
denied.push(path.join(if recursive { "**" } else { "*" }));
|
||||
}
|
||||
|
||||
self.emit(Event::PathForbidden(path.to_path_buf()));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user