This commit is contained in:
parent
ddf06f54c1
commit
f36f0f7530
@ -271,7 +271,7 @@ impl Config {
|
|||||||
|
|
||||||
fn file_(suffix: &str) -> PathBuf {
|
fn file_(suffix: &str) -> PathBuf {
|
||||||
let name = format!("{}{}", *APP_NAME.read().unwrap(), suffix);
|
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 {
|
pub fn get_home() -> PathBuf {
|
||||||
@ -687,6 +687,16 @@ impl Config {
|
|||||||
lock.store();
|
lock.store();
|
||||||
true
|
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";
|
const PEERS: &str = "peers";
|
||||||
@ -716,7 +726,7 @@ impl PeerConfig {
|
|||||||
|
|
||||||
fn path(id: &str) -> PathBuf {
|
fn path(id: &str) -> PathBuf {
|
||||||
let path: PathBuf = [PEERS, id].iter().collect();
|
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)> {
|
pub fn peers() -> Vec<(String, SystemTime, PeerConfig)> {
|
||||||
|
Loading…
Reference in New Issue
Block a user