get rid of useless newlines

This commit is contained in:
SadlyNotSappho 2023-07-09 15:14:41 -07:00
parent 2fec70e307
commit 7fff3a4ceb
2 changed files with 3 additions and 8 deletions

View File

@ -2,11 +2,6 @@ use std::{fs, path::Path};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
pub struct ConfigFile {
pub latest_date: String,
pub cache_folder: String,
}
pub fn get_home() -> String { pub fn get_home() -> String {
let home = match std::env::consts::OS { let home = match std::env::consts::OS {
"linux" => std::env::var("HOME").expect("how is there not a $HOME"), "linux" => std::env::var("HOME").expect("how is there not a $HOME"),
@ -50,8 +45,8 @@ pub fn read_config(file: &String) -> Config {
pub fn ensure_exists(path: &String) { pub fn ensure_exists(path: &String) {
let replaced = path.replace('~', &get_home()[..]); // replace ~ with $HOME let replaced = path.replace('~', &get_home()[..]); // replace ~ with $HOME
let p = Path::new(&replaced); let p = Path::new(&replaced);
println!("{}", replaced); // println!("{}", replaced);
println!("{:?}", p.exists()); // println!("{:?}", p.exists());
if !p.exists() { if !p.exists() {
fs::create_dir_all(p).expect("couldn't create folder") fs::create_dir_all(p).expect("couldn't create folder")
} }

View File

@ -11,7 +11,7 @@ fn main() {
let args = Args::parse(); let args = Args::parse();
let config_file = args.config_file; let config_file = args.config_file;
println!("{}", config_file); // println!("{}", config_file);
ggg::create_config(&config_file); ggg::create_config(&config_file);
let config = ggg::read_config(&config_file); let config = ggg::read_config(&config_file);
ggg::ensure_exists(&config.cache_folder); ggg::ensure_exists(&config.cache_folder);