use std::fs; use std::path::Path; fn main() -> std::io::Result<()> { let key = if cfg!(windows) { "LOCALAPPDATA" } else { "HOME" }; let mut home_dir = match std::env::var(key) { Ok(dir) => dir, Err(_) => panic!("Unable to install required files"), }; if !cfg!(windows) { home_dir = format!("{}/.local/share", home_dir); } if !Path::new(&format!("{}/amogus/", home_dir)).exists() { fs::create_dir(&format!("{}/amogus/", home_dir))?; for i in 0..6 { fs::copy( format!("./amogus/{}.png", i), format!("{}/amogus/{}.png", home_dir, i), )?; } } else { println!("Necessary files already installed"); } Ok(()) }