rss-tool/src/files.rs

14 lines
428 B
Rust
Raw Normal View History

use std::{fs,io};
use directories_next::ProjectDirs;
pub fn get_data_directory() -> std::path::PathBuf {
let dirs = ProjectDirs::from("rocks","gabe","RSSCar").expect("Failed to get paths");
match fs::create_dir(dirs.data_dir()){
Ok(_) => {}
Err(e) if e.kind() == io::ErrorKind::AlreadyExists => {}
Err(e) => {println!("Unable to create data directory")}
};
dirs.data_dir().to_owned()
}