From 7c848716effe295b2021bf1739842f22abfb8dc1 Mon Sep 17 00:00:00 2001 From: KeksNino Date: Sat, 15 Mar 2025 12:41:06 +0100 Subject: [PATCH] caching png files --- src/gui.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/gui.rs b/src/gui.rs index f3d8cf1..85b5a07 100644 --- a/src/gui.rs +++ b/src/gui.rs @@ -61,10 +61,16 @@ fn build_ui(app: &Application) { container.append(&image); let dest_path = - Path::new("/home/user.cache/LinuxWEGUI/").join(path.file_name().unwrap()); + Path::new("/home/user/.cache/LinuxWEGUI/").join(path.file_name().unwrap()); + + if let Some(parent_dir) = dest_path.parent() { + fs::create_dir_all(parent_dir).expect("Failed to create parent directory"); + } fs::copy(path, dest_path).expect("yeet"); + // fs::copy(path, dest_path).expect("yeet"); + // fs::copy(path, "/home/user.cache/LinuxWEGUI/").expect("yeet"); } }