From 7074bbc4055cdf59c642c32d9dc6a8b0858a1d71 Mon Sep 17 00:00:00 2001
From: GyDi <segydi@foxmail.com>
Date: Fri, 18 Mar 2022 11:49:00 +0800
Subject: [PATCH] feat: add wintun.dll by default

---
 src-tauri/src/utils/init.rs | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/src-tauri/src/utils/init.rs b/src-tauri/src/utils/init.rs
index 991bdcf..d44bee0 100644
--- a/src-tauri/src/utils/init.rs
+++ b/src-tauri/src/utils/init.rs
@@ -87,4 +87,14 @@ pub fn init_app(package_info: &PackageInfo) {
   if !mmdb_path.exists() && mmdb_tmpl.exists() {
     fs::copy(mmdb_tmpl, mmdb_path).unwrap();
   }
+
+  // copy the wintun.dll
+  #[cfg(target_os = "windows")]
+  {
+    let wintun_path = app_dir.join("wintun.dll");
+    let wintun_tmpl = res_dir.join("wintun.dll");
+    if !wintun_path.exists() && wintun_tmpl.exists() {
+      fs::copy(wintun_tmpl, wintun_path).unwrap();
+    }
+  }
 }
-- 
GitLab