diff --git a/Cargo.toml b/Cargo.toml index 2925093..8e1f3aa 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -30,4 +30,5 @@ env = { "RUST_LOG" = "debug" } [features] -atime_read = [] \ No newline at end of file +ekko_simulated = [] # 开启本地模拟,用于debug测试开发 +# default = ["ekko_simulated"] diff --git a/src/lib.rs b/src/lib.rs index 178a4db..ff05f08 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -235,14 +235,16 @@ impl MsgSyncPipe { } pub fn reply_msg(&mut self) { // read pipe file to update access time - #[cfg(features = "atime_read")] + #[cfg(not(feature = "ekko_simulated"))] { + print!("read pipe file to update access time"); let mut file = File::options().read(true).open(&self.pipe_file).unwrap(); let mut buffer = Vec::new(); let _ = file.read_to_end(&mut buffer); } - #[cfg(not(features = "atime_read"))] + #[cfg(feature = "ekko_simulated")] { + print!("write pipe file to update access time"); let mut file = File::options().write(true).open(&self.pipe_file).unwrap(); let _ = file.write("sstar_l0l3clip_sync".as_bytes()); drop(file); @@ -283,6 +285,7 @@ impl MsgSyncPipe { let sub_path = path.next().unwrap().to_string(); for drive in 'C'..='Z' { let sub_path = format!("{}:{}", drive, sub_path); + #[cfg(feature = "ekko_simulated")] let sub_path = sub_path.replace("baoyucang", "BYC10"); log::trace!("trying to find pipe file in {}", sub_path); let sync_pipe = Path::new(&sub_path).join("sync_pipe"); @@ -294,7 +297,10 @@ impl MsgSyncPipe { return Err("You should mapping l0 c:\\ to l3".into()) } } +#[cfg(feature = "ekko_simulated")] static VM_EXE_NAME:&str = "mstsc.exe"; +#[cfg(not(feature = "ekko_simulated"))] +static VM_EXE_NAME:&str = "vmware_view.exe"; // 同步获取消息的线程 async fn msg_reciver(ctx:Arc>) { let mut ctx = ctx.lock().await; diff --git a/src/main.rs b/src/main.rs index 0f92628..e8d654a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -9,8 +9,11 @@ use tokio::sync::Mutex; use std::sync::Arc; use clap::{App, Arg}; -// const SERVER:&str = "172.19.36.79"; + +#[cfg(feature = "ekko_simulated")] const SERVER:&str = "192.168.0.116:5000"; +#[cfg(not(feature = "ekko_simulated"))] +const SERVER:&str = "172.19.36.79"; fn param_parser() -> (Character, String) { let mut character = Character::Consumer;