This commit is contained in:
2026-08-26 20:51:00 +07:00
parent a00ee68258
commit df8b8a9598
5 changed files with 180 additions and 61 deletions
+6
View File
@@ -35,6 +35,12 @@ pub fn home_dir() -> PathBuf {
dirs::home_dir().expect("failed to determine home directory")
}
/// Returns the current user's Desktop folder, falling back to the home
/// directory (or an empty path) when it can't be determined.
pub fn desktop_dir() -> PathBuf {
dirs::desktop_dir().unwrap_or_else(|| dirs::home_dir().unwrap_or_default())
}
/// Sets a custom directory for all user data, overriding the default data
/// directory. Must be called before any other path operation. The directory
/// is created if it doesn't exist and canonicalized to an absolute path.