This commit is contained in:
2026-09-04 17:23:10 +07:00
parent 1496b7afeb
commit 15c2122f38
13 changed files with 63 additions and 46 deletions
+4
View File
@@ -2,10 +2,12 @@ use std::path::PathBuf;
use std::sync::OnceLock;
/// The application name.
///
/// It derives the platform-specific data, config and cache directory paths.
pub const APP_NAME: &str = "Signed";
/// Lowercased form of [`APP_NAME`].
///
/// Used in XDG-style paths on Linux and FreeBSD, and the macOS `~/.config` fallback.
pub const APP_NAME_LOWERCASE: &str = "signed";
@@ -27,12 +29,14 @@ pub fn home_dir() -> PathBuf {
}
/// Returns the current user's Desktop folder.
///
/// Falls back to the home directory or an empty path when it cannot be determined.
pub fn desktop_dir() -> PathBuf {
dirs::desktop_dir().unwrap_or_else(|| dirs::home_dir().unwrap_or_default())
}
/// Returns the current user's Documents folder.
///
/// Falls back to the home directory or an empty path when it cannot be determined.
pub fn documents_dir() -> PathBuf {
dirs::document_dir().unwrap_or_else(|| dirs::home_dir().unwrap_or_default())