mirror of
https://github.com/bitwarden/browser
synced 2026-02-14 23:45:37 +00:00
Cleanup
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
use std::vec;
|
||||
|
||||
use tokio::io::{AsyncRead, AsyncWrite};
|
||||
use tokio_util::codec::{Framed, LengthDelimitedCodec};
|
||||
|
||||
@@ -93,7 +95,6 @@ pub fn path(name: &str) -> std::path::PathBuf {
|
||||
/// Paths to the ipc sockets including alternative paths.
|
||||
/// For flatpak, a path per sandbox is created.
|
||||
pub fn all_paths(name: &str) -> Vec<std::path::PathBuf> {
|
||||
let paths = vec![path(name)];
|
||||
#[cfg(target_os = "linux")]
|
||||
{
|
||||
// On Linux, in flatpak, we mount sockets in each app's sandboxed directory.
|
||||
@@ -103,7 +104,12 @@ pub fn all_paths(name: &str) -> Vec<std::path::PathBuf> {
|
||||
.iter()
|
||||
.map(|path| flatpak_path.join(path).join(format!(".app.{name}.socket")))
|
||||
.collect::<Vec<_>>();
|
||||
let mut paths = vec![path(name)];
|
||||
paths.extend(flatpak_paths);
|
||||
paths
|
||||
}
|
||||
#[cfg(not(target_os = "linux"))]
|
||||
{
|
||||
vec![path(name)]
|
||||
}
|
||||
paths
|
||||
}
|
||||
|
||||
@@ -57,10 +57,8 @@ impl Server {
|
||||
for path in paths.iter() {
|
||||
// If the unix socket file already exists, we get an error when trying to bind to it. So we remove it first.
|
||||
// Any processes that were using the old socket should remain connected to it but any new connections will use the new socket.
|
||||
if !cfg!(windows) {
|
||||
if path.exists() {
|
||||
std::fs::remove_file(path)?;
|
||||
}
|
||||
if !cfg!(windows) && path.exists() {
|
||||
std::fs::remove_file(path)?;
|
||||
}
|
||||
|
||||
let name = path.as_os_str().to_fs_name::<GenericFilePath>()?;
|
||||
|
||||
Reference in New Issue
Block a user