use std::path::PathBuf;
use std::fs;
use crate::utils::error::Error;
pub async fn get_data_file<'a>(fey_config_dir_path: PathBuf) -> Result<(), Error>{
let urls_file_contents = reqwest::get("https://raw.githubusercontent.com/falkwitte/fey/main/src/urls.txt").await
.unwrap()
.text()
.await
.unwrap();
match fs::write(fey_config_dir_path.join("urls.txt"), urls_file_contents){
Ok(()) => Ok(()),
Err(error) => {
let errormsg = format!("could not create data file {}", error);
Err(Error::FatalError(errormsg))
}
}
}