fix: adjust code
This commit is contained in:
parent
f4f1a0fbc6
commit
557abd4285
@ -10,7 +10,7 @@ mod utils;
|
||||
|
||||
use crate::{
|
||||
core::VergeConfig,
|
||||
utils::{dirs, resolve, server},
|
||||
utils::{resolve, server},
|
||||
};
|
||||
use tauri::{
|
||||
api, CustomMenuItem, Manager, SystemTray, SystemTrayEvent, SystemTrayMenu, SystemTrayMenuItem,
|
||||
@ -24,6 +24,8 @@ fn main() -> std::io::Result<()> {
|
||||
|
||||
#[cfg(target_os = "windows")]
|
||||
unsafe {
|
||||
use crate::utils::dirs;
|
||||
|
||||
dirs::init_portable_flag();
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
use std::env::temp_dir;
|
||||
use std::path::PathBuf;
|
||||
use tauri::utils::platform::current_exe;
|
||||
use tauri::{
|
||||
api::path::{home_dir, resource_dir},
|
||||
Env, PackageInfo,
|
||||
@ -21,9 +20,12 @@ static PROFILE_TEMP: &str = "clash-verge-runtime.yaml";
|
||||
static mut PORTABLE_FLAG: bool = false;
|
||||
|
||||
/// initialize portable flag
|
||||
#[allow(unused)]
|
||||
pub unsafe fn init_portable_flag() {
|
||||
#[cfg(target_os = "windows")]
|
||||
{
|
||||
use tauri::utils::platform::current_exe;
|
||||
|
||||
let exe = current_exe().unwrap();
|
||||
let dir = exe.parent().unwrap();
|
||||
let dir = PathBuf::from(dir).join(".config/PORTABLE");
|
||||
@ -38,6 +40,8 @@ pub unsafe fn init_portable_flag() {
|
||||
pub fn app_home_dir() -> PathBuf {
|
||||
#[cfg(target_os = "windows")]
|
||||
unsafe {
|
||||
use tauri::utils::platform::current_exe;
|
||||
|
||||
if !PORTABLE_FLAG {
|
||||
home_dir().unwrap().join(".config").join(APP_DIR)
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user