From 9908a3d931a07d321536d752797735c6a8009e69 Mon Sep 17 00:00:00 2001 From: Nathan Ansel Date: Mon, 19 May 2025 11:52:51 -0500 Subject: [PATCH] Always use app group for IPC connection --- .../desktop_native/core/src/ipc/mod.rs | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/apps/desktop/desktop_native/core/src/ipc/mod.rs b/apps/desktop/desktop_native/core/src/ipc/mod.rs index 531aeaa0a0b..71b0c58341e 100644 --- a/apps/desktop/desktop_native/core/src/ipc/mod.rs +++ b/apps/desktop/desktop_native/core/src/ipc/mod.rs @@ -56,19 +56,19 @@ pub fn path(name: &str) -> std::path::PathBuf { .position(|c| c.as_os_str() == "Containers"); // If the app is sanboxed, we need to use the App Group directory - if let Some(position) = containers_position { - // We want to use App Groups in /Users//Library/Group Containers/LTZ2PFU5D6.com.bitwarden.desktop, - // so we need to remove all the components after the user. We can use the previous position to do this. - while home.components().count() > position - 1 { - home.pop(); - } - - let tmp = home.join("Library/Group Containers/LTZ2PFU5D6.com.bitwarden.desktop/tmp"); - - // The tmp directory might not exist, so create it - let _ = std::fs::create_dir_all(&tmp); - return tmp.join(format!("app.{name}")); + let position = containers_position.unwrap_or(4); + + // We want to use App Groups in /Users//Library/Group Containers/LTZ2PFU5D6.com.bitwarden.desktop, + // so we need to remove all the components after the user. We can use the previous position to do this. + while home.components().count() > position - 1 { + home.pop(); } + + let tmp = home.join("Library/Group Containers/LTZ2PFU5D6.com.bitwarden.desktop/tmp"); + + // The tmp directory might not exist, so create it + let _ = std::fs::create_dir_all(&tmp); + return tmp.join(format!("app.{name}")); } #[cfg(any(target_os = "linux", target_os = "macos"))]