2025-03-30 14:30:33 -03:00
|
|
|
// Prevents additional console window on Windows in release, DO NOT REMOVE!!
|
|
|
|
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
|
|
|
|
|
|
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
use std::env;
|
2025-03-30 16:42:51 -03:00
|
|
|
use std::fs::{create_dir_all, File, OpenOptions};
|
|
|
|
use std::io::Write;
|
|
|
|
use std::path::Path;
|
|
|
|
use std::process::{Command, Stdio};
|
|
|
|
use std::sync::Mutex;
|
|
|
|
use tauri::{Manager, Window};
|
2025-03-30 14:30:33 -03:00
|
|
|
|
2025-03-30 16:42:51 -03:00
|
|
|
pub mod drive;
|
|
|
|
use drive::Drive::;
|
2025-03-30 14:30:33 -03:00
|
|
|
|
2025-03-30 13:38:55 -03:00
|
|
|
// Learn more about Tauri commands at https://tauri.app/develop/calling-rust/
|
|
|
|
#[tauri::command]
|
|
|
|
fn greet(name: &str) -> String {
|
|
|
|
format!("Hello, {}! You've been greeted from Rust!", name)
|
|
|
|
}
|
|
|
|
|
|
|
|
#[cfg_attr(mobile, tauri::mobile_entry_point)]
|
|
|
|
pub fn run() {
|
|
|
|
tauri::Builder::default()
|
2025-03-30 16:42:51 -03:00
|
|
|
.manage(AppState {
|
|
|
|
sync_processes: Mutex::new(Vec::new()),
|
|
|
|
sync_active: Mutex::new(false),
|
|
|
|
})
|
|
|
|
.plugin(tauri_plugin_opener::init())
|
2025-03-30 14:30:33 -03:00
|
|
|
.invoke_handler(tauri::generate_handler![
|
|
|
|
save_config,
|
2025-03-30 16:42:51 -03:00
|
|
|
list_files,
|
2025-03-30 14:30:33 -03:00
|
|
|
start_sync,
|
|
|
|
stop_sync,
|
2025-03-30 16:42:51 -03:00
|
|
|
get_status
|
|
|
|
])
|
2025-03-30 13:38:55 -03:00
|
|
|
.run(tauri::generate_context!())
|
|
|
|
.expect("error while running tauri application");
|
|
|
|
}
|