summaryrefslogtreecommitdiffhomepage
path: root/mullvad-paths/src/rpc_socket.rs
blob: 1398db93d2c37d8c3b49c8e69667d8b2dda5307a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
use std::{env, path::PathBuf};

pub fn get_rpc_socket_path() -> PathBuf {
    match env::var_os("MULLVAD_RPC_SOCKET_PATH") {
        Some(path) => PathBuf::from(path),
        None => get_default_rpc_socket_path(),
    }
}

pub fn get_default_rpc_socket_path() -> PathBuf {
    #[cfg(any(target_os = "linux", target_os = "macos"))]
    {
        PathBuf::from("/var/run/mullvad-vpn")
    }
    #[cfg(windows)]
    {
        PathBuf::from("//./pipe/Mullvad VPN")
    }
    #[cfg(target_os = "android")]
    {
        PathBuf::from(format!("{}/rpc-socket", crate::APP_PATH))
    }
}