mirror of
https://github.com/rustdesk/rustdesk.git
synced 2024-11-27 14:59:02 +08:00
Merge pull request #5197 from 21pages/opt
log nothing if config file not found
This commit is contained in:
commit
97f14d21e8
@ -56,7 +56,6 @@ lazy_static::lazy_static! {
|
||||
pub static ref EXE_RENDEZVOUS_SERVER: Arc<RwLock<String>> = Default::default();
|
||||
pub static ref APP_NAME: Arc<RwLock<String>> = Arc::new(RwLock::new("RustDesk".to_owned()));
|
||||
static ref KEY_PAIR: Arc<Mutex<Option<KeyPair>>> = Default::default();
|
||||
static ref HW_CODEC_CONFIG: Arc<RwLock<HwCodecConfig>> = Arc::new(RwLock::new(HwCodecConfig::load()));
|
||||
static ref USER_DEFAULT_CONFIG: Arc<RwLock<(UserDefaultConfig, Instant)>> = Arc::new(RwLock::new((UserDefaultConfig::load(), Instant::now())));
|
||||
}
|
||||
|
||||
@ -404,6 +403,11 @@ pub fn load_path<T: serde::Serialize + serde::de::DeserializeOwned + Default + s
|
||||
let cfg = match confy::load_path(&file) {
|
||||
Ok(config) => config,
|
||||
Err(err) => {
|
||||
if let confy::ConfyError::GeneralLoadError(err) = &err {
|
||||
if err.kind() == std::io::ErrorKind::NotFound {
|
||||
return T::default();
|
||||
}
|
||||
}
|
||||
log::error!("Failed to load config '{}': {}", file.display(), err);
|
||||
T::default()
|
||||
}
|
||||
@ -1362,16 +1366,6 @@ impl HwCodecConfig {
|
||||
pub fn clear() {
|
||||
HwCodecConfig::default().store();
|
||||
}
|
||||
|
||||
/// refresh current global HW_CODEC_CONFIG, usually uesd after HwCodecConfig::remove()
|
||||
pub fn refresh() {
|
||||
*HW_CODEC_CONFIG.write().unwrap() = HwCodecConfig::load();
|
||||
log::debug!("HW_CODEC_CONFIG refreshed successfully");
|
||||
}
|
||||
|
||||
pub fn get() -> HwCodecConfig {
|
||||
return HW_CODEC_CONFIG.read().unwrap().clone();
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Default, Serialize, Deserialize, Clone)]
|
||||
|
@ -314,7 +314,7 @@ impl HwDecoderImage<'_> {
|
||||
}
|
||||
|
||||
fn get_config(k: &str) -> ResultType<CodecInfos> {
|
||||
let v = HwCodecConfig::get()
|
||||
let v = HwCodecConfig::load()
|
||||
.options
|
||||
.get(k)
|
||||
.unwrap_or(&"".to_owned())
|
||||
@ -375,10 +375,7 @@ pub fn check_config_process() {
|
||||
// wait up to 10 seconds
|
||||
for _ in 0..10 {
|
||||
std::thread::sleep(std::time::Duration::from_secs(1));
|
||||
if let Ok(Some(status)) = child.try_wait() {
|
||||
if status.success() {
|
||||
HwCodecConfig::refresh();
|
||||
}
|
||||
if let Ok(Some(_)) = child.try_wait() {
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -399,7 +396,6 @@ pub fn check_config_process() {
|
||||
log::error!("Check hwcodec config, error attempting to wait: {e}")
|
||||
}
|
||||
}
|
||||
HwCodecConfig::refresh();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -77,7 +77,7 @@ pub fn core_main() -> Option<Vec<String>> {
|
||||
#[cfg(target_os = "linux")]
|
||||
#[cfg(feature = "flutter")]
|
||||
{
|
||||
let (k, v) = ("LIBGL_ALWAYS_SOFTWARE", "true");
|
||||
let (k, v) = ("LIBGL_ALWAYS_SOFTWARE", "1");
|
||||
if !hbb_common::config::Config::get_option("allow-always-software-render").is_empty() {
|
||||
std::env::set_var(k, v);
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user