summaryrefslogtreecommitdiffstats
path: root/zellij-utils/src/consts.rs
diff options
context:
space:
mode:
authorKunal Mohan <kunalmohan99@gmail.com>2021-05-22 15:45:47 +0530
committerKunal Mohan <kunalmohan99@gmail.com>2021-05-22 22:19:50 +0530
commitfa0a7e05c384f0da1a6fe3dd240181a6ff528b58 (patch)
treeb188dbaefc080c0155475634c7427d8322fa5ef9 /zellij-utils/src/consts.rs
parentac082a1c930a356253f5cb3b685aabe28f87cba6 (diff)
Add ability to attach to sessions
Diffstat (limited to 'zellij-utils/src/consts.rs')
-rw-r--r--zellij-utils/src/consts.rs5
1 files changed, 3 insertions, 2 deletions
diff --git a/zellij-utils/src/consts.rs b/zellij-utils/src/consts.rs
index 012e36999..f22dd4893 100644
--- a/zellij-utils/src/consts.rs
+++ b/zellij-utils/src/consts.rs
@@ -4,6 +4,7 @@ use crate::shared::set_permissions;
use directories_next::ProjectDirs;
use lazy_static::lazy_static;
use nix::unistd::Uid;
+use once_cell::sync::OnceCell;
use std::path::PathBuf;
use std::{env, fs};
@@ -24,7 +25,7 @@ const fn system_default_data_dir() -> &'static str {
lazy_static! {
static ref UID: Uid = Uid::current();
- pub static ref SESSION_NAME: String = names::Generator::default().next().unwrap();
+ pub static ref SESSION_NAME: OnceCell<String> = OnceCell::new();
pub static ref ZELLIJ_PROJ_DIR: ProjectDirs =
ProjectDirs::from("org", "Zellij Contributors", "Zellij").unwrap();
pub static ref ZELLIJ_SOCK_DIR: PathBuf = {
@@ -43,7 +44,7 @@ lazy_static! {
let mut sock_dir = ZELLIJ_SOCK_DIR.clone();
fs::create_dir_all(&sock_dir).unwrap();
set_permissions(&sock_dir).unwrap();
- sock_dir.push(&*SESSION_NAME);
+ sock_dir.push(SESSION_NAME.get().unwrap());
sock_dir
};
pub static ref ZELLIJ_TMP_DIR: PathBuf =