refactor: wip

This commit is contained in:
GyDi
2022-11-14 01:26:33 +08:00
parent afc37c71a6
commit 837422fbb8
32 changed files with 2704 additions and 880 deletions

View File

@@ -87,19 +87,28 @@ pub fn init_resources(package_info: &PackageInfo) {
}
// copy the resource file
let mmdb_path = app_dir.join("Country.mmdb");
let mmdb_tmpl = res_dir.join("Country.mmdb");
if !mmdb_path.exists() && mmdb_tmpl.exists() {
let _ = fs::copy(mmdb_tmpl, mmdb_path);
}
// 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() {
let _ = fs::copy(wintun_tmpl, wintun_path);
for file in ["Country.mmdb", "geoip.dat", "geosite.dat", "wintun.dll"].iter() {
let src_path = res_dir.join(file);
let target_path = app_dir.join(file);
if src_path.exists() {
let _ = fs::copy(src_path, target_path);
}
}
// // copy the resource file
// let mmdb_path = app_dir.join("Country.mmdb");
// let mmdb_tmpl = res_dir.join("Country.mmdb");
// if !mmdb_path.exists() && mmdb_tmpl.exists() {
// let _ = fs::copy(mmdb_tmpl, mmdb_path);
// }
// // 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() {
// let _ = fs::copy(wintun_tmpl, wintun_path);
// }
// }
}