@@ -108,42 +108,63 @@ async fn take_screenshot(_options: Option<ScreenshotOptions>) -> Result<String,
108108
109109#[ tauri:: command]
110110async fn read_file ( path : String , _options : Option < FileOperationOptions > ) -> Result < String , String > {
111- println ! ( "🔍 Rust: read_file called with path: '{}'" , path) ;
111+ let log_msg = format ! ( "🔍 Rust: read_file called with path: '{}'\n " , path) ;
112+ let _ = std:: fs:: write ( "/tmp/tauri-debug.log" , log_msg. as_bytes ( ) ) ;
113+
112114 let result = std:: fs:: read_to_string ( & path) . map_err ( |e| {
113115 let error_msg = format ! ( "Failed to read file '{}': {}" , path, e) ;
114- println ! ( "🔍 Rust: read_file error: {}" , error_msg) ;
116+ let log_msg = format ! ( "🔍 Rust: read_file error: {}\n " , error_msg) ;
117+ let _ = std:: fs:: write ( "/tmp/tauri-debug.log" , log_msg. as_bytes ( ) ) ;
115118 error_msg
116119 } ) ;
117120 if result. is_ok ( ) {
118- println ! ( "🔍 Rust: read_file succeeded for path: '{}', content length: {}" , path, result. as_ref( ) . unwrap( ) . len( ) ) ;
121+ let log_msg = format ! ( "🔍 Rust: read_file succeeded for path: '{}', content length: {}\n " , path, result. as_ref( ) . unwrap( ) . len( ) ) ;
122+ let _ = std:: fs:: write ( "/tmp/tauri-debug.log" , log_msg. as_bytes ( ) ) ;
119123 }
120124 result
121125}
122126
123127#[ tauri:: command]
124128async fn write_file ( path : String , contents : String , _options : Option < FileOperationOptions > ) -> Result < ( ) , String > {
125- println ! ( "🔍 Rust: write_file called with path: '{}', contents length: {}" , path, contents. len( ) ) ;
129+ let log_msg = format ! ( "🔍 Rust: write_file called with path: '{}', contents length: {}\n " , path, contents. len( ) ) ;
130+ let _ = std:: fs:: write ( "/tmp/tauri-debug.log" , log_msg. as_bytes ( ) ) ;
131+
126132 std:: fs:: write ( & path, contents) . map_err ( |e| {
127133 let error_msg = format ! ( "Failed to write file '{}': {}" , path, e) ;
128- println ! ( "🔍 Rust: write_file error: {}" , error_msg) ;
134+ let log_msg = format ! ( "🔍 Rust: write_file error: {}\n " , error_msg) ;
135+ let _ = std:: fs:: write ( "/tmp/tauri-debug.log" , log_msg. as_bytes ( ) ) ;
129136 error_msg
130137 } ) ?;
131- println ! ( "🔍 Rust: write_file succeeded for path: '{}'" , path) ;
138+
139+ let log_msg = format ! ( "🔍 Rust: write_file succeeded for path: '{}'\n " , path) ;
140+ let _ = std:: fs:: write ( "/tmp/tauri-debug.log" , log_msg. as_bytes ( ) ) ;
132141 Ok ( ( ) )
133142}
134143
135144#[ tauri:: command]
136145async fn delete_file ( path : String ) -> Result < ( ) , String > {
137- println ! ( "🔍 Rust: delete_file called with path: '{}'" , path) ;
146+ let log_msg = format ! ( "🔍 Rust: delete_file called with path: '{}'\n " , path) ;
147+ let _ = std:: fs:: write ( "/tmp/tauri-debug.log" , log_msg. as_bytes ( ) ) ;
148+
138149 std:: fs:: remove_file ( & path) . map_err ( |e| {
139150 let error_msg = format ! ( "Failed to delete file '{}': {}" , path, e) ;
140- println ! ( "🔍 Rust: delete_file error: {}" , error_msg) ;
151+ let log_msg = format ! ( "🔍 Rust: delete_file error: {}\n " , error_msg) ;
152+ let _ = std:: fs:: write ( "/tmp/tauri-debug.log" , log_msg. as_bytes ( ) ) ;
141153 error_msg
142154 } ) ?;
143- println ! ( "🔍 Rust: delete_file succeeded for path: '{}'" , path) ;
155+
156+ let log_msg = format ! ( "🔍 Rust: delete_file succeeded for path: '{}'\n " , path) ;
157+ let _ = std:: fs:: write ( "/tmp/tauri-debug.log" , log_msg. as_bytes ( ) ) ;
144158 Ok ( ( ) )
145159}
146160
161+ #[ tauri:: command]
162+ async fn get_current_dir ( ) -> Result < String , String > {
163+ std:: env:: current_dir ( )
164+ . map ( |path| path. to_string_lossy ( ) . to_string ( ) )
165+ . map_err ( |e| e. to_string ( ) )
166+ }
167+
147168#[ tauri:: command]
148169async fn get_platform_info ( ) -> Result < PlatformInfo , String > {
149170 let mut sys = System :: new_all ( ) ;
@@ -190,6 +211,8 @@ async fn write_clipboard(content: String) -> Result<(), String> {
190211}
191212
192213fn main ( ) {
214+ let _ = std:: fs:: write ( "/tmp/tauri-debug.log" , "🔍 Rust: Tauri app starting...\n " ) ;
215+
193216 tauri:: Builder :: default ( )
194217 . invoke_handler ( tauri:: generate_handler![
195218 get_window_bounds,
@@ -202,6 +225,7 @@ fn main() {
202225 read_file,
203226 write_file,
204227 delete_file,
228+ get_current_dir,
205229 get_platform_info,
206230 read_clipboard,
207231 write_clipboard
0 commit comments