diff options
Diffstat (limited to 'src/compose.rs')
-rw-r--r-- | src/compose.rs | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/compose.rs b/src/compose.rs index 3d2a2db..c90f470 100644 --- a/src/compose.rs +++ b/src/compose.rs @@ -1,6 +1,7 @@ use crate::poem::{read::Readable, recite::Reciteable, Poem}; pub mod environment; pub use environment::Environment; +use std::env; use std::fs; use std::path::PathBuf; @@ -18,8 +19,17 @@ pub fn env() -> Environment { }; // User defined rc file in ~ - let mut local_rc = PathBuf::from(env!("HOME")); - local_rc.push(".dwvshrc"); + let local_rc = match env::var("HOME") { + Ok(val) => { + let mut rc = PathBuf::from(val); + rc.push(".dwvshrc"); + rc + } + Err(_) => { + eprintln!("dwvsh: unknown home, falling back to /etc"); + PathBuf::from(&global_rc) + } + }; // Read, read, and recite rrr(global_rc, &mut env); |