@@ -5,12 +5,11 @@ windows_subsystem = "windows"
55use std:: env;
66
77use tauri:: { Manager } ;
8+ use std:: path:: PathBuf ;
89
910#[ cfg( target_os = "linux" ) ]
1011use std:: fs:: metadata;
1112#[ cfg( target_os = "linux" ) ]
12- use std:: path:: PathBuf ;
13- #[ cfg( target_os = "linux" ) ]
1413use gtk:: { glib:: ObjectExt , prelude:: WidgetExt } ;
1514
1615use std:: process:: Command ;
@@ -61,6 +60,10 @@ fn _get_commandline_args() -> Option<Vec<String>> {
6160 Some ( env:: args ( ) . collect ( ) )
6261}
6362
63+ #[ tauri:: command]
64+ fn get_current_working_dir ( ) -> Result < PathBuf , String > {
65+ env:: current_dir ( ) . map_err ( |e| e. to_string ( ) )
66+ }
6467
6568#[ tauri:: command]
6669fn _rename_path ( old_path : & str , new_path : & str ) -> Result < ( ) , String > {
@@ -287,7 +290,7 @@ fn main() {
287290 . on_window_event ( |event| process_window_event ( & event) )
288291 . invoke_handler ( tauri:: generate_handler![
289292 get_mac_deep_link_requests,
290- toggle_devtools, console_log, console_error, _get_commandline_args,
293+ toggle_devtools, console_log, console_error, _get_commandline_args, get_current_working_dir ,
291294 _get_window_labels,
292295 _get_windows_drives, _rename_path, show_in_folder, zoom_window, _get_clipboard_files] )
293296 . setup ( |app| {
0 commit comments