Created
March 31, 2023 13:35
-
-
Save ae5259/353445f5e32b7ee211086dbe5433c23b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::{ | |
env, | |
fs::{self, File}, | |
path::Path, | |
}; | |
pub fn config() { | |
let config_path = format!( | |
"/home/{}/.xonfig/", | |
env::var("LOGNAME").unwrap_or(".config".to_owned()) | |
); | |
let file_path = format!( | |
"/home/{}/.xonfig/.xonfig", | |
env::var("LOGNAME").unwrap_or(".xonfig".to_owned()) | |
); | |
println!("{}", config_path); | |
if !Path::new(&file_path).exists() { | |
fs::create_dir(config_path); | |
File::create(file_path).unwrap(); | |
} | |
} | |
fn main() { | |
config(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment