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