use std::marker::PhantomData; use mingling_core::{ ProgramCollect, setup::ProgramSetup, }; use crate::res::{ResCurrentDir, ResCurrentExe, ResHomeDir, ResTempDir}; /// Provides the ability to set up commonly used directory resources for the program. /// /// This setup item registers the following directory resources in the program: /// - `ResCurrentDir`: Current working directory /// - `ResCurrentExe`: Directory containing the executable /// - `ResHomeDir`: User's home directory /// - `ResTempDir`: Temporary directory pub struct DirectoryEnvironmentSetup { _collect: PhantomData, } impl Default for DirectoryEnvironmentSetup where C: ProgramCollect + 'static, { fn default() -> Self { Self { _collect: PhantomData, } } } impl ProgramSetup for DirectoryEnvironmentSetup where C: ProgramCollect + 'static, { fn setup(self, program: &mut crate::Program) { program.with_resource(ResCurrentDir::default()); program.with_resource(ResCurrentExe::default()); program.with_resource(ResHomeDir::default()); program.with_resource(ResTempDir::default()); } }