Skip to content
Snippets Groups Projects
Unverified Commit a3e7626d authored by GyDi's avatar GyDi Committed by GitHub
Browse files

chore: add dev feature

parent 5cb5d74e
No related branches found
No related tags found
No related merge requests found
...@@ -40,3 +40,4 @@ winreg = { version = "0.10", features = ["transactions"] } ...@@ -40,3 +40,4 @@ winreg = { version = "0.10", features = ["transactions"] }
[features] [features]
default = [ "custom-protocol" ] default = [ "custom-protocol" ]
custom-protocol = [ "tauri/custom-protocol" ] custom-protocol = [ "tauri/custom-protocol" ]
verge-dev = []
...@@ -5,12 +5,22 @@ use tauri::{ ...@@ -5,12 +5,22 @@ use tauri::{
Env, PackageInfo, Env, PackageInfo,
}; };
#[cfg(not(feature = "verge-dev"))]
static APP_DIR: &str = "clash-verge";
#[cfg(feature = "verge-dev")]
static APP_DIR: &str = "clash-verge-dev";
static CLASH_CONFIG: &str = "config.yaml";
static VERGE_CONFIG: &str = "verge.yaml";
static PROFILE_YAML: &str = "profiles.yaml";
static PROFILE_TEMP: &str = "clash-verge-runtime.yaml";
/// get the verge app home dir /// get the verge app home dir
pub fn app_home_dir() -> PathBuf { pub fn app_home_dir() -> PathBuf {
home_dir() home_dir()
.unwrap() .unwrap()
.join(Path::new(".config")) .join(Path::new(".config"))
.join(Path::new("clash-verge")) .join(Path::new(APP_DIR))
} }
/// get the resources dir /// get the resources dir
...@@ -30,11 +40,6 @@ pub fn app_logs_dir() -> PathBuf { ...@@ -30,11 +40,6 @@ pub fn app_logs_dir() -> PathBuf {
app_home_dir().join("logs") app_home_dir().join("logs")
} }
static CLASH_CONFIG: &str = "config.yaml";
static VERGE_CONFIG: &str = "verge.yaml";
static PROFILE_YAML: &str = "profiles.yaml";
static PROFILE_TEMP: &str = "clash-verge-runtime.yaml";
pub fn clash_path() -> PathBuf { pub fn clash_path() -> PathBuf {
app_home_dir().join(CLASH_CONFIG) app_home_dir().join(CLASH_CONFIG)
} }
......
...@@ -4,7 +4,10 @@ use port_scanner::local_port_available; ...@@ -4,7 +4,10 @@ use port_scanner::local_port_available;
use tauri::{AppHandle, Manager}; use tauri::{AppHandle, Manager};
use warp::Filter; use warp::Filter;
#[cfg(not(feature = "verge-dev"))]
const SERVER_PORT: u16 = 33333; const SERVER_PORT: u16 = 33333;
#[cfg(feature = "verge-dev")]
const SERVER_PORT: u16 = 11233;
/// check whether there is already exists /// check whether there is already exists
pub fn check_singleton() -> Result<(), ()> { pub fn check_singleton() -> Result<(), ()> {
......
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