Skip to content

Instantly share code, notes, and snippets.

@ae5259
Created March 31, 2023 13:35
Show Gist options
  • Save ae5259/353445f5e32b7ee211086dbe5433c23b to your computer and use it in GitHub Desktop.
Save ae5259/353445f5e32b7ee211086dbe5433c23b to your computer and use it in GitHub Desktop.
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