aboutsummaryrefslogtreecommitdiffstats
path: root/src/main.rs
diff options
context:
space:
mode:
authorJonas Maier <>2026-03-06 14:29:41 +0100
committerJonas Maier <>2026-03-06 14:29:41 +0100
commite6831f59011128e10be2e84f1da6a56fe0416652 (patch)
tree663cedceb5bf558b4ca19d9a5eb50b1bc6ffdef2 /src/main.rs
parent8e822ae856a0ae49e530c95ad7a6dc2812bfb837 (diff)
downloadpish-e6831f59011128e10be2e84f1da6a56fe0416652.tar.gz
create config and data dir
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/main.rs b/src/main.rs
index 95d24d5..7c51497 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -1,9 +1,12 @@
use std::ffi::OsStr;
+use std::fs;
use std::io::{self, IsTerminal, Read, Write};
use std::os::unix::ffi::OsStrExt;
use std::os::unix::io::AsRawFd;
use std::path::Path;
use std::process::{Command, Stdio};
+use std::thread::sleep;
+use std::time::Duration;
pub mod completion;
pub mod cursor;
@@ -13,6 +16,7 @@ pub mod parse;
pub mod raw;
pub mod reload;
pub mod run;
+mod basedir;
use linebuf::LineBuf;
use raw::*;
@@ -146,6 +150,9 @@ fn event_loop() {
let raw = ScopedRawMode::on_fd(fd);
raw.enable();
+ fs::create_dir_all(basedir::config_dir()).unwrap();
+ fs::create_dir_all(basedir::data_dir()).unwrap();
+
let mut se = Session {
raw,
line: LineBuf::new(),
@@ -327,6 +334,9 @@ fn main() {
}
}
}
+
+ // prevent incredibly fast panic loops
+ sleep(Duration::from_secs(1));
}
println!("bye");