diff options
| author | Naz <ndpm13@ch-naseem.com> | 2025-07-31 15:59:56 +0100 |
|---|---|---|
| committer | Naz <ndpm13@ch-naseem.com> | 2025-07-31 15:59:56 +0100 |
| commit | 180fe06facf1f8b4796df69a42596643990b9d32 (patch) | |
| tree | e4fc09be4c29c01a1f62e988a19e99d1c3a7a85e /src/paths.rs | |
| parent | 030eef4c9b4f82fe16ddd019c436e7065758d3dc (diff) | |
✨feat: remove expect from path module
Diffstat (limited to 'src/paths.rs')
| -rw-r--r-- | src/paths.rs | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/paths.rs b/src/paths.rs index 172cae6..7bbc8f8 100644 --- a/src/paths.rs +++ b/src/paths.rs @@ -1,14 +1,16 @@ use std::path::PathBuf; -pub fn zap_rs_home() -> PathBuf { - let home = std::env::var("HOME").expect("HOME not set"); - PathBuf::from(home).join(".local/share/zap-rs") +use crate::Result; + +pub fn zap_rs_home() -> Result<PathBuf> { + let home = std::env::var("HOME")?; + Ok(PathBuf::from(home).join(".local/share/zap-rs")) } -pub fn index_dir() -> PathBuf { - zap_rs_home().join("index") +pub fn index_dir() -> Result<PathBuf> { + Ok(zap_rs_home()?.join("index")) } -pub fn appimages_dir() -> PathBuf { - zap_rs_home().join("appimages") +pub fn appimages_dir() -> Result<PathBuf> { + Ok(zap_rs_home()?.join("appimages")) } |
