0
0
Fork 0
mirror of https://git.verdigado.com/NB-Public/simple-wkd.git synced 2024-12-06 14:52:41 +01:00

Add toml settings

This commit is contained in:
Delta1925 2023-04-14 00:52:54 +02:00
parent d3a1860a2d
commit 291e0070c4
No known key found for this signature in database
GPG key ID: 1C21ACE44193CB25
8 changed files with 121 additions and 18 deletions

View file

@ -1,5 +1,5 @@
use crate::errors::Error;
use crate::{PATH, PENDING, VARIANT};
use crate::settings::SETTINGS;
use rand::{distributions::Alphanumeric, thread_rng, Rng};
use sequoia_net::wkd::Url;
@ -9,7 +9,8 @@ use std::path::{Path, PathBuf};
#[macro_export]
macro_rules! pending_path {
() => {
Path::new(PATH).join(PENDING)
Path::new(&SETTINGS.folder_structure.root_folder)
.join(&SETTINGS.folder_structure.pending_folder)
};
}
@ -45,7 +46,7 @@ pub fn get_user_file_path(email: &str) -> Result<PathBuf, Error> {
Ok(wkd_url) => wkd_url,
Err(_) => return Err(Error::PathGeneration),
};
match wkd_url.to_file_path(VARIANT) {
match wkd_url.to_file_path(SETTINGS.variant) {
Ok(path) => Ok(path),
Err(_) => Err(Error::PathGeneration),
}