summaryrefslogtreecommitdiffstats
path: root/zellij-utils/src/consts.rs
diff options
context:
space:
mode:
authorKen Matsui <26405363+ken-matsui@users.noreply.github.com>2021-11-10 17:02:17 +0900
committerGitHub <noreply@github.com>2021-11-10 09:02:17 +0100
commit6d60d83e5808d3ccc5073f9f92368f38b8f3ae41 (patch)
tree89d7c43cbdf7e71c6e6c11a20bf96379904e39a0 /zellij-utils/src/consts.rs
parent03f58fc184bc1be47a8da526563e60a21a1fced0 (diff)
fix(envs): Unify operation of Zellij environment variables (#842)
Diffstat (limited to 'zellij-utils/src/consts.rs')
-rw-r--r--zellij-utils/src/consts.rs7
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 =