duat 0.1.2

A Highly customizable text editor, configured through the use of a rust crate.
Documentation
use std::{
    fs::{self, File},
    io::Write,
};

const UI_TO_USE: &[u8] = b"features = [\"term-ui\"]";

const LIB: &[u8] = include_bytes!("default-config/lib.rs_");
const TOML: &[u8] = include_bytes!("default-config/Cargo.toml_");

fn main() {
    let Some(config_path) = dirs_next::config_dir() else {
        return;
    };

    if !config_path.exists() {
        return;
    }

    let dest = config_path.join("duat");

    if dest.exists() {
        return;
    }

    if fs::create_dir_all(&dest).is_err() {
        return;
    };

    if fs::create_dir_all(dest.join("src")).is_err() {
        return;
    };

    let mut src = File::create(dest.join("src/lib.rs")).unwrap();
    src.write_all(LIB).unwrap();

    let mut toml = File::create(dest.join("Cargo.toml")).unwrap();

    toml.write_all(TOML).unwrap();
    toml.write_all(UI_TO_USE).unwrap();
}