diff options
| author | Hiro <laciferin2024@protonmail.com> | 2026-03-28 15:07:00 +0530 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-03-28 10:37:00 +0100 |
| commit | ec0834f4f23f3ea7e4a22ed07e3610d7b8fe4081 (patch) | |
| tree | cf692834668725a139bacefbfd098cf23062e44a | |
| parent | Support OSC-99 desktop notifications (#4931) (diff) | |
| download | sl0ppij-ec0834f4f23f3ea7e4a22ed07e3610d7b8fe4081.tar.gz sl0ppij-ec0834f4f23f3ea7e4a22ed07e3610d7b8fe4081.tar.xz sl0ppij-ec0834f4f23f3ea7e4a22ed07e3610d7b8fe4081.zip | |
fix(windows): normalize temp socket paths (#4923)
| -rw-r--r-- | Cargo.lock | 1 | ||||
| -rw-r--r-- | zellij-utils/Cargo.toml | 1 | ||||
| -rw-r--r-- | zellij-utils/src/consts.rs | 21 |
3 files changed, 20 insertions, 3 deletions
@@ -4960,6 +4960,7 @@ dependencies = [ "crossterm", "curl-sys", "directories", + "dunce", "expect-test", "humantime", "include_dir", diff --git a/zellij-utils/Cargo.toml b/zellij-utils/Cargo.toml index 4c659cf9..24f0e8c2 100644 --- a/zellij-utils/Cargo.toml +++ b/zellij-utils/Cargo.toml @@ -65,6 +65,7 @@ windows-sys = { workspace = true, features = [ "Win32_System_Threading", ] } winapi = { version = "0.3.9", default-features = false } +dunce = "1.0" [dev-dependencies] insta = { version = "1.6.0", features = ["backtrace"] } diff --git a/zellij-utils/src/consts.rs b/zellij-utils/src/consts.rs index 0ef1f2bf..64c3ad95 100644 --- a/zellij-utils/src/consts.rs +++ b/zellij-utils/src/consts.rs @@ -307,24 +307,39 @@ mod not_unix { use super::*; use crate::envs; pub use crate::shared::set_permissions; + #[cfg(windows)] + use dunce; use lazy_static::lazy_static; use std::env::temp_dir; + #[cfg(windows)] + fn canonicalize_path(path: PathBuf) -> PathBuf { + dunce::canonicalize(&path).unwrap_or(path) + } + + #[cfg(not(windows))] + fn canonicalize_path(path: PathBuf) -> PathBuf { + path + } + pub const ZELLIJ_SOCK_MAX_LENGTH: usize = 256; lazy_static! { - pub static ref ZELLIJ_TMP_DIR: PathBuf = temp_dir().join("zellij"); + pub static ref ZELLIJ_TMP_DIR: PathBuf = { + let tmp_dir = canonicalize_path(temp_dir()); + tmp_dir.join("zellij") + }; 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 = { - let mut ipc_dir = envs::get_socket_dir().map_or_else( + let mut ipc_dir = canonicalize_path(envs::get_socket_dir().map_or_else( |_| { ZELLIJ_PROJ_DIR .runtime_dir() .map_or_else(|| ZELLIJ_TMP_DIR.clone(), |p| p.to_owned()) }, PathBuf::from, - ); + )); ipc_dir.push(CLIENT_SERVER_CONTRACT_DIR.clone()); ipc_dir }; |
