A photo manager for VRChat.
at main 25 lines 629 B view raw
1use std::fs; 2 3use tauri::{Emitter, State, Window}; 4 5use crate::util::cache::Cache; 6 7#[tauri::command] 8pub fn change_final_path(new_path: &str, window: Window, cache: State<Cache>) -> bool { 9 match fs::metadata(&new_path) { 10 Ok(_) => { 11 let config_path = dirs::config_dir() 12 .unwrap() 13 .join("PhazeDev/VRChatPhotoManager/.photos_path"); 14 15 fs::write(&config_path, new_path.as_bytes()).unwrap(); 16 cache.insert("photo-path".into(), new_path.to_owned()); 17 18 true 19 } 20 Err(_) => { 21 window.emit("vrcpm-error", "Error Changing Path: Path does not exist.").unwrap(); 22 false 23 } 24 } 25}