mostro_client/util/
misc.rs1use std::{fs, path::Path};
2
3pub fn uppercase_first(s: &str) -> String {
4 let mut c = s.chars();
5 match c.next() {
6 None => String::new(),
7 Some(f) => f.to_uppercase().collect::<String>() + c.as_str(),
8 }
9}
10
11pub fn get_mcli_path() -> String {
12 let home_dir = dirs::home_dir().expect("Couldn't get home directory");
13 let mcli_path = format!("{}/.mcliUserA", home_dir.display());
14 if !Path::new(&mcli_path).exists() {
15 fs::create_dir(&mcli_path).expect("Couldn't create mostro-cli directory in HOME");
16 println!("Directory {} created.", mcli_path);
17 }
18 mcli_path
19}