Skip to content
Snippets Groups Projects
Unverified Commit 557abd42 authored by GyDi's avatar GyDi
Browse files

fix: adjust code

parent f4f1a0fb
No related branches found
No related tags found
No related merge requests found
......@@ -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();
}
......
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 {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment