mirror of
https://github.com/weyne85/rustdesk.git
synced 2025-10-29 17:00:05 +00:00
Merge pull request #5197 from 21pages/opt
log nothing if config file not found
This commit is contained in:
@@ -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)]
|
||||
|
||||
Reference in New Issue
Block a user