fix: use temp_dir for getting temp folder (#1898)

This commit is contained in:
Jonathan LEI 2022-11-08 23:39:30 +08:00 committed by GitHub
parent 1bb12e720e
commit 6c79ff9b31
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -45,7 +45,7 @@ mod unix_only {
use crate::shared::set_permissions;
use lazy_static::lazy_static;
use nix::unistd::Uid;
use std::fs;
use std::{env::temp_dir, fs};
lazy_static! {
static ref UID: Uid = Uid::current();
@ -56,7 +56,7 @@ mod unix_only {
sock_dir.push(envs::get_session_name().unwrap());
sock_dir
};
pub static ref ZELLIJ_TMP_DIR: PathBuf = PathBuf::from(format!("/tmp/zellij-{}", *UID));
pub static ref ZELLIJ_TMP_DIR: PathBuf = temp_dir().join(format!("zellij-{}", *UID));
pub static ref ZELLIJ_TMP_LOG_DIR: PathBuf = ZELLIJ_TMP_DIR.join("zellij-log");
pub static ref ZELLIJ_TMP_LOG_FILE: PathBuf = ZELLIJ_TMP_LOG_DIR.join("zellij.log");
pub static ref ZELLIJ_SOCK_DIR: PathBuf = {