// take default config and write it to path of default config location
// error out if the config already exists
take default config and write it to path of default config location
error out if the config already exists
take default config and write it to path of default config location error out if the config already exists
pub fn create_default_config(path: &PathBuf) -> Result<String, io::Error> {
    match OpenOptions::new()
                .write(true)
                .create_new(true)
                .open(path.clone()) {
        Ok(mut file) => {
            match file.write_all(&String::from(DEFAULT_CONF).into_bytes()) {
                Ok(_) => (),
                Err(e) => return Err(e)
            };
            match file.flush() {
                Ok(_) => (),
                Err(e) => return Err(e)
            };
            Ok(String::from(path.to_str().unwrap()))
        },
        Err(e) => Err(e)
    }
}
pub fn create_default_config ( path : & PathBuf ) -> Result < String , io :: Error > { match OpenOptions :: new ( ) . write ( true ) . create_new ( true ) . open ( path . clone ( ) ) { Ok ( mut file ) => { match file . write_all ( & String :: from ( DEFAULT_CONF ) . into_bytes ( ) ) { Ok ( _ ) => ( ) , Err ( e ) => return Err ( e ) } ; match file . flush ( ) { Ok ( _ ) => ( ) , Err ( e ) => return Err ( e ) } ; Ok ( String :: from ( path . to_str ( ) . unwrap ( ) ) ) } , Err ( e ) => Err ( e ) } }
take default config and write it to path of default config location
error out if the config already exists
take default config and write it to path of default config location error out if the config already exists
path
&PathBuf