Move config file to ~/.config/fwd/config.toml
Presumably this also works for MacOS and windows. While doing this, move away from xdg and home and use this directories-next crate instead. Reverse connections still seem to work.
This commit is contained in:
parent
663ce42016
commit
38fbfbd918
4 changed files with 57 additions and 29 deletions
|
|
@ -62,13 +62,15 @@ impl Config {
|
|||
pub fn load_config() -> Result<Config> {
|
||||
use std::io::ErrorKind;
|
||||
|
||||
let mut home = match home::home_dir() {
|
||||
Some(h) => h,
|
||||
None => return Ok(default()),
|
||||
let Some(directories) = directories_next::ProjectDirs::from("", "", "fwd")
|
||||
else {
|
||||
return Ok(default());
|
||||
};
|
||||
home.push(".fwd");
|
||||
|
||||
let contents = match std::fs::read_to_string(home) {
|
||||
let mut config_path = directories.config_dir().to_path_buf();
|
||||
config_path.push("config.toml");
|
||||
|
||||
let contents = match std::fs::read_to_string(config_path) {
|
||||
Ok(contents) => contents,
|
||||
Err(e) => match e.kind() {
|
||||
ErrorKind::NotFound => return Ok(default()),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue