diff options
| author | anand <anand.panchdhari@gmail.com> | 2025-11-19 10:51:26 +0530 |
|---|---|---|
| committer | anand <anand.panchdhari@gmail.com> | 2025-11-19 10:51:26 +0530 |
| commit | 7f99a356c31ee24566899c24404fc25d9486d474 (patch) | |
| tree | a84e21b2e66c28bf0625b7370b36ac63c958b8d1 /src/main.rs | |
| parent | 5dd65997c90334fad1bd526fc6a891c861f3b5d5 (diff) | |
Diffstat (limited to 'src/main.rs')
| -rw-r--r-- | src/main.rs | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/main.rs b/src/main.rs index b28778d..7aa63b2 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,8 +1,16 @@ -use std::{fs, path::Path}; +use dirs; +use std::{fs, path::PathBuf}; + +fn tmux_dir() -> PathBuf { + let mut dir = dirs::home_dir().expect("No home dir found"); + dir.push(".tmux-thing"); + dir +} fn main() { let mut result = Ok(()); - if !Path::new("~/.tmux-thing").exists() { - result = fs::create_dir("~/.tmux-thing"); + let dirpath = tmux_dir(); + if !dirpath.exists() { + result = fs::create_dir(dirpath); } println!("{:?}", result) } |
