@@ -146,7 +146,11 @@ async fn close_splashscreen(window: tauri::Window) {
146
146
}
147
147
148
148
#[ tauri:: command]
149
- async fn unzip_archive ( archive_path : String , target_dir : String ) -> Result < String , String > {
149
+ async fn unzip_archive (
150
+ window : tauri:: Window ,
151
+ archive_path : String ,
152
+ target_dir : String ,
153
+ ) -> Result < String , String > {
150
154
// The third parameter allows you to strip away toplevel directories.
151
155
// If `archive` contained a single directory, its contents would be extracted instead.
152
156
let _target_dir = std:: path:: PathBuf :: from ( target_dir) ; // Doesn't need to exist
@@ -155,18 +159,13 @@ async fn unzip_archive(archive_path: String, target_dir: String) -> Result<Strin
155
159
zip_extract:: extract ( std:: io:: Cursor :: new ( archive) , & _target_dir, true )
156
160
. expect ( "Failed to extract archive" ) ;
157
161
158
- // erase the archive
159
- std:: fs:: remove_file ( archive_path) . expect ( "Failed to remove archive" ) ;
162
+ // erase the archive file
163
+ //window.app_handle(|app| {
164
+ // let _ = app.remove_path(&archive_path);
165
+ //});
160
166
Ok ( "Archive extracted" . to_string ( ) )
161
167
}
162
168
163
- #[ tauri:: command]
164
- async fn remove_archive ( archive_path : String ) -> Result < String , String > {
165
- // erase the archive
166
- std:: fs:: remove_file ( archive_path) . expect ( "Failed to remove archive" ) ;
167
- Ok ( "Archive removed" . to_string ( ) )
168
- }
169
-
170
169
fn main ( ) {
171
170
let quit = CustomMenuItem :: new ( "quit" . to_string ( ) , "Quit" ) ;
172
171
let hide = CustomMenuItem :: new ( "hide" . to_string ( ) , "Hide" ) ;
@@ -194,8 +193,7 @@ fn main() {
194
193
run_mdns_query,
195
194
get_user,
196
195
do_rest_request,
197
- unzip_archive,
198
- remove_archive
196
+ unzip_archive
199
197
] )
200
198
// allow only one instance and propgate args and cwd to existing instance
201
199
. plugin ( tauri_plugin_single_instance:: init ( |app, args, cwd| {
0 commit comments