@@ -132,14 +132,17 @@ pub(crate) async fn open<R: Runtime>(
132
132
let res = if options. directory {
133
133
#[ cfg( desktop) ]
134
134
{
135
+ let tauri_scope = window. state :: < tauri:: scope:: Scopes > ( ) ;
136
+
135
137
if options. multiple {
136
138
let folders = dialog_builder. blocking_pick_folders ( ) ;
137
139
if let Some ( folders) = & folders {
138
140
for folder in folders {
139
141
if let Ok ( path) = folder. clone ( ) . into_path ( ) {
140
142
if let Some ( s) = window. try_fs_scope ( ) {
141
- s. allow_directory ( path, options. recursive ) ;
143
+ s. allow_directory ( & path, options. recursive ) ;
142
144
}
145
+ tauri_scope. allow_directory ( & path, options. directory ) ?;
143
146
}
144
147
}
145
148
}
@@ -151,8 +154,9 @@ pub(crate) async fn open<R: Runtime>(
151
154
if let Some ( folder) = & folder {
152
155
if let Ok ( path) = folder. clone ( ) . into_path ( ) {
153
156
if let Some ( s) = window. try_fs_scope ( ) {
154
- s. allow_directory ( path, options. recursive ) ;
157
+ s. allow_directory ( & path, options. recursive ) ;
155
158
}
159
+ tauri_scope. allow_directory ( & path, options. directory ) ?;
156
160
}
157
161
}
158
162
OpenResponse :: Folder ( folder. map ( |p| p. simplified ( ) ) )
@@ -161,6 +165,8 @@ pub(crate) async fn open<R: Runtime>(
161
165
#[ cfg( mobile) ]
162
166
return Err ( crate :: Error :: FolderPickerNotImplemented ) ;
163
167
} else if options. multiple {
168
+ let tauri_scope = window. state :: < tauri:: scope:: Scopes > ( ) ;
169
+
164
170
let files = dialog_builder. blocking_pick_files ( ) ;
165
171
if let Some ( files) = & files {
166
172
for file in files {
@@ -169,20 +175,21 @@ pub(crate) async fn open<R: Runtime>(
169
175
s. allow_file ( & path) ;
170
176
}
171
177
172
- window . state :: < tauri :: scope :: Scopes > ( ) . allow_file ( & path) ?;
178
+ tauri_scope . allow_file ( & path) ?;
173
179
}
174
180
}
175
181
}
176
182
OpenResponse :: Files ( files. map ( |files| files. into_iter ( ) . map ( |f| f. simplified ( ) ) . collect ( ) ) )
177
183
} else {
184
+ let tauri_scope = window. state :: < tauri:: scope:: Scopes > ( ) ;
178
185
let file = dialog_builder. blocking_pick_file ( ) ;
179
186
180
187
if let Some ( file) = & file {
181
188
if let Ok ( path) = file. clone ( ) . into_path ( ) {
182
189
if let Some ( s) = window. try_fs_scope ( ) {
183
190
s. allow_file ( & path) ;
184
191
}
185
- window . state :: < tauri :: scope :: Scopes > ( ) . allow_file ( & path) ?;
192
+ tauri_scope . allow_file ( & path) ?;
186
193
}
187
194
}
188
195
OpenResponse :: File ( file. map ( |f| f. simplified ( ) ) )
@@ -216,13 +223,15 @@ pub(crate) async fn save<R: Runtime>(
216
223
dialog_builder = dialog_builder. add_filter ( filter. name , & extensions) ;
217
224
}
218
225
226
+ let tauri_scope = window. state :: < tauri:: scope:: Scopes > ( ) ;
227
+
219
228
let path = dialog_builder. blocking_save_file ( ) ;
220
229
if let Some ( p) = & path {
221
230
if let Ok ( path) = p. clone ( ) . into_path ( ) {
222
231
if let Some ( s) = window. try_fs_scope ( ) {
223
232
s. allow_file ( & path) ;
224
233
}
225
- window . state :: < tauri :: scope :: Scopes > ( ) . allow_file ( & path) ?;
234
+ tauri_scope . allow_file ( & path) ?;
226
235
}
227
236
}
228
237
0 commit comments