rustdesk 2022-06-10 18:25:25 +08:00
parent ddf06f54c1
commit f36f0f7530

View File

@ -271,7 +271,7 @@ impl Config {
fn file_(suffix: &str) -> PathBuf {
let name = format!("{}{}", *APP_NAME.read().unwrap(), suffix);
Self::path(name).with_extension("toml")
Config::with_extension(Self::path(name))
}
pub fn get_home() -> PathBuf {
@ -687,6 +687,16 @@ impl Config {
lock.store();
true
}
fn with_extension(path: PathBuf) -> PathBuf {
let ext = path.extension();
if let Some(ext) = ext {
let ext = format!("{}.toml", ext.to_string_lossy());
path.with_extension(&ext)
} else {
path.with_extension("toml")
}
}
}
const PEERS: &str = "peers";
@ -716,7 +726,7 @@ impl PeerConfig {
fn path(id: &str) -> PathBuf {
let path: PathBuf = [PEERS, id].iter().collect();
Config::path(path).with_extension("toml")
Config::with_extension(Config::path(path))
}
pub fn peers() -> Vec<(String, SystemTime, PeerConfig)> {