pub mod apis; pub mod config; pub mod commands; pub mod input; pub mod db; pub mod error; pub mod files; use std::path::Path; pub use apis::*; pub use commands::*; use error::{MLE, ErrorType, MLError}; #[derive(Debug, Clone, PartialEq, Eq)] pub enum Modloader { Fabric, Forge } impl Modloader { fn to_string(&self) -> String { match self { Modloader::Fabric => String::from("fabric"), Modloader::Forge => String::from("forge"), } } fn from(string: &str) -> MLE { match string { "forge" => Ok(Modloader::Forge), "fabric" => Ok(Modloader::Fabric), _ => Err(MLError::new(ErrorType::ArgumentError, "UNKNOWN_MODLOADER")) } } } pub fn devdir(path: &str) -> String { let p = Path::new(path); let dev = std::env::var("DEV"); let lvl = match dev { Ok(dev) => dev.parse::().unwrap(), Err(..) => 0, }; if lvl >= 1 { format!("./dev/{}", p.file_name().unwrap().to_str().unwrap()) } else { String::from(path) } }