diff options
Diffstat (limited to 'zellij-utils/src/consts.rs')
-rw-r--r-- | zellij-utils/src/consts.rs | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/zellij-utils/src/consts.rs b/zellij-utils/src/consts.rs index bcb4ea4aa..f20dadaac 100644 --- a/zellij-utils/src/consts.rs +++ b/zellij-utils/src/consts.rs @@ -1,10 +1,10 @@ //! Zellij program-wide constants. +use crate::envs; 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}; @@ -26,11 +26,10 @@ const fn system_default_data_dir() -> &'static str { lazy_static! { static ref UID: Uid = Uid::current(); - 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 = { - let mut ipc_dir = env::var("ZELLIJ_SOCKET_DIR").map_or_else( + let mut ipc_dir = envs::get_socket_dir().map_or_else( |_| { ZELLIJ_PROJ_DIR .runtime_dir() @@ -45,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.get().unwrap()); + sock_dir.push(envs::get_session_name().unwrap()); sock_dir }; pub static ref ZELLIJ_TMP_DIR: PathBuf = |