summaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs14
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)
}