You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
546 B
Rust
25 lines
546 B
Rust
pub mod fedi;
|
|
pub mod pixiv;
|
|
pub mod reddit;
|
|
pub mod urls;
|
|
|
|
use crate::error::Result;
|
|
use directories::ProjectDirs;
|
|
use std::{fs, path::PathBuf};
|
|
|
|
pub fn get_project_dirs() -> ProjectDirs {
|
|
ProjectDirs::from("net", "trivernis", "hydrus-utils")
|
|
.expect("Could not create application directories")
|
|
}
|
|
|
|
pub fn get_config_dir() -> Result<PathBuf> {
|
|
let dirs = get_project_dirs();
|
|
let config_dir = dirs.config_dir();
|
|
|
|
if !config_dir.exists() {
|
|
fs::create_dir_all(config_dir)?;
|
|
}
|
|
|
|
Ok(PathBuf::from(config_dir))
|
|
}
|