@setoelkahfi / svara / commits / b1487ef

wip

Seto Elkahfi committed Apr 7, 2025 at 21:26 UTC b1487efe6bccf6a9bdb764fbcd4e875ce0223257
1 file changed +12 -11
src-tauri/src/main.rs
+12 -11
@@ -4,10 +4,10 @@
4 )]
5
6 #[cfg(debug_assertions)]
7 -const LOG_TARGETS: [LogTarget; 2] = [LogTarget::Stdout, LogTarget::Webview];
7 +const LOG_TARGETS: [tauri_plugin_log::TargetKind; 2] = [tauri_plugin_log::TargetKind::Stdout, tauri_plugin_log::TargetKind::Webview];
8
9 #[cfg(not(debug_assertions))]
10 -const LOG_TARGETS: [LogTarget; 2] = [LogTarget::Stdout, LogTarget::LogDir];
10 +const LOG_TARGETS: [Target; 2] = [Target::Stdout, Target::LogDir];
11
12 use std::collections::{self, HashMap};
13 use std::fs::File;
@@ -19,7 +19,7 @@ use tauri::{App, Manager, Wry};
19 use encoding::BOM;
20 use log::{error, info, Level};
21 use tauri::plugin::TauriPlugin;
22 -use tauri_plugin_log::{RotationStrategy};
22 +use tauri_plugin_log::{Target, RotationStrategy};
23 use crate::encoding::convert_to_u16;
24
25 mod encoding;
@@ -90,7 +90,7 @@ fn is_folder(path: &str) -> bool {
90
91 #[tauri::command]
92 fn attempt_file_access(app_handle: tauri::AppHandle, p: &str) {
93 - app_handle.fs_scope().allow_directory(p, true).unwrap();
93 + // app_handle.fs_scope().allow_directory(p, true).unwrap();
94 }
95
96 #[tauri::command]
@@ -309,7 +309,7 @@ fn configure_log() -> TauriPlugin<Wry> {
309 message
310 ))
311 })
312 - .targets(LOG_TARGETS)
312 + // .targets(LOG_TARGETS)
313 .filter(|l| {
314 let mut filter = false;
315 if cfg!(debug_assertions) {
@@ -325,7 +325,7 @@ fn configure_log() -> TauriPlugin<Wry> {
325 }
326
327 fn configure_log_path(app: &mut App) {
328 - let app_log_dir = tauri::api::path::app_log_dir(&app.config()).unwrap();
328 + let app_log_dir = app.path().app_log_dir().unwrap();
329 let old_log_path = app_log_dir.join("svara.log");
330 if !Path::exists(&old_log_path) {
331 return;
@@ -369,9 +369,9 @@ fn load_settings(app: &mut App) {
369 }
370 );
371
372 - let appdata_local = match tauri::api::path::app_local_data_dir(&app.config()) {
373 - Some(path) => path,
374 - None => {
372 + let appdata_local = match app.path().local_data_dir() {
373 + Ok(path) => path,
374 + Err(err) => {
375 error!("Failed to get app local data directory");
376 return;
377 }
@@ -415,9 +415,10 @@ fn load_settings(app: &mut App) {
415 .defaults(defaults)
416 .build();
417
418 + /*
419 if let Err(e) = settings_store.load() {
420 error!("Failed to load settings: {}", e);
420 - }
421 + } */
422 }
423
424 fn main() {
@@ -441,7 +442,7 @@ fn main() {
442 is_supported,
443 open_terminal
444 ])
444 - .plugin(tauri_plugin_fs_watch::init())
445 + //.plugin(tauri_plugin_fs_watch::init())
446 .plugin(tauri_plugin_store::Builder::default().build())
447 .plugin(configure_log())
448 .plugin(tauri_plugin_pty::init())