From 6ab54d7ec9308d97216f25f55a7bee434a43ee2d Mon Sep 17 00:00:00 2001 From: arabian Date: Sun, 6 Jul 2025 21:03:09 +0300 Subject: [PATCH] move creation of dirs to the separate function --- src/main.rs | 37 +++++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/src/main.rs b/src/main.rs index 0cbd80c..d84e661 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,10 +1,31 @@ use eframe::NativeOptions; use egui::Vec2; use std::fs; +use std::fs::create_dir; mod app; fn main() -> Result<(), eframe::Error> { + create_dirs(); + + let mut options = NativeOptions { + ..Default::default() + }; + options.viewport.min_inner_size = Some(Vec2::new(400.0, 400.0)); + options.vsync = true; + options.hardware_acceleration = eframe::HardwareAcceleration::Preferred; + + eframe::run_native( + "PipeWire SoundPad", + options, + Box::new(|cc| { + egui_material_icons::initialize(&cc.egui_ctx); + Ok(Box::new(app::App::new(cc))) + }), + ) +} + +fn create_dirs() { let config_dir_path = dirs::config_dir().unwrap().join("pwsp"); fs::create_dir_all(&config_dir_path).ok(); @@ -26,20 +47,4 @@ fn main() -> Result<(), eframe::Error> { { fs::File::create(config_dir_path.join("saved_volume")).ok(); } - - let mut options = NativeOptions { - ..Default::default() - }; - options.viewport.min_inner_size = Some(Vec2::new(400.0, 400.0)); - options.vsync = true; - options.hardware_acceleration = eframe::HardwareAcceleration::Preferred; - - eframe::run_native( - "PipeWire SoundPad", - options, - Box::new(|cc| { - egui_material_icons::initialize(&cc.egui_ctx); - Ok(Box::new(app::App::new(cc))) - }), - ) }