better conditional compilation

Signed-off-by: dignow <linlong1265@gmail.com>
This commit is contained in:
dignow
2023-06-24 21:09:45 +08:00
parent b9652d165b
commit d15deabba5
10 changed files with 147 additions and 94 deletions

View File

@@ -44,7 +44,7 @@ lazy_static::lazy_static! {
static ref CONFIG: Arc<RwLock<Config>> = Arc::new(RwLock::new(Config::load()));
static ref CONFIG2: Arc<RwLock<Config2>> = Arc::new(RwLock::new(Config2::load()));
static ref LOCAL_CONFIG: Arc<RwLock<LocalConfig>> = Arc::new(RwLock::new(LocalConfig::load()));
pub static ref ONLINE: Arc<Mutex<HashMap<String, i64>>> = Default::default();
static ref ONLINE: Arc<Mutex<HashMap<String, i64>>> = Default::default();
pub static ref PROD_RENDEZVOUS_SERVER: Arc<RwLock<String>> = Arc::new(RwLock::new(match option_env!("RENDEZVOUS_SERVER") {
Some(key) if !key.is_empty() => key,
_ => "",
@@ -309,6 +309,11 @@ pub struct TransferSerde {
pub read_jobs: Vec<String>,
}
#[inline]
pub fn get_online_statue() -> i64 {
*ONLINE.lock().unwrap().values().max().unwrap_or(&0)
}
#[cfg(not(any(target_os = "android", target_os = "ios")))]
fn patch(path: PathBuf) -> PathBuf {
if let Some(_tmp) = path.to_str() {

View File

@@ -1,20 +1,21 @@
extern crate repng;
extern crate scrap;
use std::fs::File;
use scrap::{i420_to_rgb, Display};
use scrap::Display;
#[cfg(windows)]
use scrap::{CapturerMag, TraitCapturer};
use scrap::{i420_to_rgb, CapturerMag, TraitCapturer};
#[cfg(windows)]
use std::fs::File;
fn main() {
let n = Display::all().unwrap().len();
for i in 0..n {
for _i in 0..n {
#[cfg(windows)]
record(i);
record(_i);
}
}
#[cfg(windows)]
fn get_display(i: usize) -> Display {
Display::all().unwrap().remove(i)
}

View File

@@ -1,7 +1,8 @@
#[cfg(windows)]
pub mod win10;
use hbb_common::{bail, lazy_static, ResultType};
#[cfg(windows)]
use hbb_common::lazy_static;
use hbb_common::{bail, ResultType};
use std::path::Path;
#[cfg(windows)]