aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/lib.rs7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 7a6a6de..f8a8702 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -42,7 +42,12 @@ impl WireGuard {
debug!("Created socket.");
// Create the socket directory if not existing
- let mut socket_path = PathBuf::from("/var").join("run").join("wireguard");
+ let mut socket_path = if Path::new("/run").exists() {
+ PathBuf::from("/run")
+ } else {
+ PathBuf::from("/var").join("run")
+ };
+ socket_path.join("wireguard");
if !socket_path.exists() {
create_dir(&socket_path)?;
debug!("Created socket path: {}", socket_path.display());