mirror of
https://github.com/tauri-apps/plugins-workspace.git
synced 2026-06-06 13:53:54 +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:
+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